diff options
author | Leandro Dorileo <dorileo@profusion.mobi> | 2012-11-23 21:52:02 +0000 |
---|---|---|
committer | Bruno Dilly <bdilly@profusion.mobi> | 2012-11-23 21:52:02 +0000 |
commit | 889ba8d30705a22fd15aa23a5a5f87ce9fc3455a (patch) | |
tree | 6a0ab7c93141d37b2cae91bfcf164fcd82a1a80f /legacy/ephysics/src/lib | |
parent | f4ce94ee1842950acc783e3fddcb4d07a2b29f0b (diff) | |
download | efl-889ba8d30705a22fd15aa23a5a5f87ce9fc3455a.tar.gz efl-889ba8d30705a22fd15aa23a5a5f87ce9fc3455a.tar.xz efl-889ba8d30705a22fd15aa23a5a5f87ce9fc3455a.zip |
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
Diffstat (limited to 'legacy/ephysics/src/lib')
-rw-r--r-- | legacy/ephysics/src/lib/ephysics_body.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/legacy/ephysics/src/lib/ephysics_body.cpp b/legacy/ephysics/src/lib/ephysics_body.cpp index 8ab396208..1869a3b9b 100644 --- a/legacy/ephysics/src/lib/ephysics_body.cpp +++ b/legacy/ephysics/src/lib/ephysics_body.cpp @@ -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) |