EPhysics: fix soft body resize

When resizing a soft body move the anchored rigid body to the
center of it.


Patch by: Leandro Dorileo <dorileo@profusion.mobi>



SVN revision: 79606
This commit is contained in:
Leandro Dorileo 2012-11-23 21:52:02 +00:00 committed by Bruno Dilly
parent f4ce94ee18
commit 889ba8d307
1 changed files with 9 additions and 1 deletions

View File

@ -956,7 +956,9 @@ static void
_ephysics_body_resize(EPhysics_Body *body, Evas_Coord w, Evas_Coord h, Evas_Coord d)
{
double rate, sx, sy, sz;
btVector3 body_scale;
btVector3 body_scale, center;
btScalar radius;
btTransform trans;
rate = ephysics_world_rate_get(body->world);
sx = w / rate;
@ -968,6 +970,12 @@ _ephysics_body_resize(EPhysics_Body *body, Evas_Coord w, Evas_Coord h, Evas_Coor
{
body->soft_body->scale(btVector3(1, 1, 1) / body->scale);
body->soft_body->scale(body_scale);
body->soft_body->getCollisionShape()->getBoundingSphere(center, radius);
trans.setIdentity();
trans.setOrigin(center);
body->rigid_body->proceedToTransform(trans);
_ephysics_body_soft_body_constraints_rebuild(body);
}
else if (body->type == EPHYSICS_BODY_TYPE_CLOTH)