-Support for changing fonts

-Detect when free() might crash the project and throw error
-fixed 2D Bounce in physics (3d still broken)
-renamed “on_top” property to “behind_parent”, which makes more sense, old on_top remains there for compatibility but is invisible.
-large amount of fixes
This commit is contained in:
Juan Linietsky
2014-04-05 12:39:30 -03:00
parent 35b84d2c85
commit 9f33134c93
47 changed files with 1599 additions and 268 deletions

View File

@ -375,6 +375,18 @@ bool BodyPair2DSW::setup(float p_step) {
}
#endif
c.bounce=MAX(A->get_bounce(),B->get_bounce());
if (c.bounce) {
Vector2 crA( -A->get_angular_velocity() * c.rA.y, A->get_angular_velocity() * c.rA.x );
Vector2 crB( -B->get_angular_velocity() * c.rB.y, B->get_angular_velocity() * c.rB.x );
Vector2 dv = B->get_linear_velocity() + crB - A->get_linear_velocity() - crA;
c.bounce = c.bounce * dv.dot(c.normal);
}
}
return true;
@ -420,8 +432,7 @@ void BodyPair2DSW::solve(float p_step) {
A->apply_bias_impulse(c.rA,-jb);
B->apply_bias_impulse(c.rB, jb);
real_t bounce=MAX(A->get_bounce(),B->get_bounce());
real_t jn = -(bounce + vn)*c.mass_normal;
real_t jn = -(c.bounce + vn)*c.mass_normal;
real_t jnOld = c.acc_normal_impulse;
c.acc_normal_impulse = MAX(jnOld + jn, 0.0f);

View File

@ -66,6 +66,8 @@ class BodyPair2DSW : public Constraint2DSW {
bool active;
Vector2 rA,rB;
bool reused;
float bounce;
};
Vector2 offset_B; //use local A coordinates to avoid numerical issues on collision detection