summaryrefslogtreecommitdiff
path: root/legacy/ephysics/src
diff options
context:
space:
mode:
authorLeandro Dorileo <dorileo@profusion.mobi>2012-11-23 21:52:02 +0000
committerBruno Dilly <bdilly@profusion.mobi>2012-11-23 21:52:02 +0000
commit889ba8d30705a22fd15aa23a5a5f87ce9fc3455a (patch)
tree6a0ab7c93141d37b2cae91bfcf164fcd82a1a80f /legacy/ephysics/src
parentf4ce94ee1842950acc783e3fddcb4d07a2b29f0b (diff)
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 '')
-rw-r--r--legacy/ephysics/src/lib/ephysics_body.cpp10
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 8ab3962083..1869a3b9bd 100644
--- a/legacy/ephysics/src/lib/ephysics_body.cpp
+++ b/legacy/ephysics/src/lib/ephysics_body.cpp
@@ -956,7 +956,9 @@ static void
956_ephysics_body_resize(EPhysics_Body *body, Evas_Coord w, Evas_Coord h, Evas_Coord d) 956_ephysics_body_resize(EPhysics_Body *body, Evas_Coord w, Evas_Coord h, Evas_Coord d)
957{ 957{
958 double rate, sx, sy, sz; 958 double rate, sx, sy, sz;
959 btVector3 body_scale; 959 btVector3 body_scale, center;
960 btScalar radius;
961 btTransform trans;
960 962
961 rate = ephysics_world_rate_get(body->world); 963 rate = ephysics_world_rate_get(body->world);
962 sx = w / rate; 964 sx = w / rate;
@@ -968,6 +970,12 @@ _ephysics_body_resize(EPhysics_Body *body, Evas_Coord w, Evas_Coord h, Evas_Coor
968 { 970 {
969 body->soft_body->scale(btVector3(1, 1, 1) / body->scale); 971 body->soft_body->scale(btVector3(1, 1, 1) / body->scale);
970 body->soft_body->scale(body_scale); 972 body->soft_body->scale(body_scale);
973
974 body->soft_body->getCollisionShape()->getBoundingSphere(center, radius);
975 trans.setIdentity();
976 trans.setOrigin(center);
977 body->rigid_body->proceedToTransform(trans);
978
971 _ephysics_body_soft_body_constraints_rebuild(body); 979 _ephysics_body_soft_body_constraints_rebuild(body);
972 } 980 }
973 else if (body->type == EPHYSICS_BODY_TYPE_CLOTH) 981 else if (body->type == EPHYSICS_BODY_TYPE_CLOTH)