aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/ephysics/src/lib
diff options
context:
space:
mode:
authorLeandro Dorileo <dorileo@profusion.mobi>2012-12-03 21:28:52 +0000
committerLeandro Dorileo <dorileo@profusion.mobi>2012-12-03 21:28:52 +0000
commitf481315a265987d7de4cc8eeea80f56d708091af (patch)
tree45e4ecba813e15c7d526e5a9dccffab57fa38d50 /legacy/ephysics/src/lib
parent154041e62e235b9355157a2bfe68845a1917db6b (diff)
downloadefl-f481315a265987d7de4cc8eeea80f56d708091af.tar.gz
efl-f481315a265987d7de4cc8eeea80f56d708091af.tar.xz
efl-f481315a265987d7de4cc8eeea80f56d708091af.zip
EPhysics: fix soft body rotation_set
--This line, and those below, will be ignored-- SVN revision: 80104
Diffstat (limited to 'legacy/ephysics/src/lib')
-rw-r--r--legacy/ephysics/src/lib/ephysics_body.cpp27
1 files changed, 24 insertions, 3 deletions
diff --git a/legacy/ephysics/src/lib/ephysics_body.cpp b/legacy/ephysics/src/lib/ephysics_body.cpp
index 72439aa32..afce7883b 100644
--- a/legacy/ephysics/src/lib/ephysics_body.cpp
+++ b/legacy/ephysics/src/lib/ephysics_body.cpp
@@ -3864,6 +3864,27 @@ ephysics_body_rotation_get(const EPhysics_Body *body, EPhysics_Quaternion *rotat
return quat;
}
+static void
+_ephysics_body_soft_body_rotation_set(EPhysics_Body *body, btTransform trans)
+{
+ btSoftBody::Node *node;
+ const btScalar margin= body->soft_body->getCollisionShape()->getMargin();
+ ATTRIBUTE_ALIGNED16(btDbvtVolume) vol;
+
+ for (int i = 0; i < body->soft_body->m_nodes.size(); i++)
+ {
+ node = &body->soft_body->m_nodes[i];
+ node->m_n = (trans.getBasis() * btVector3(1, 1, 1));
+ vol = btDbvtVolume::FromCR(node->m_x, margin);
+
+ body->soft_body->m_ndbvt.update(node->m_leaf, vol);
+ }
+
+ body->soft_body->updateNormals();
+ body->soft_body->updateBounds();
+ body->soft_body->updateConstants();
+}
+
EAPI void
ephysics_body_rotation_set(EPhysics_Body *body, EPhysics_Quaternion *quat)
{
@@ -3889,13 +3910,13 @@ ephysics_body_rotation_set(EPhysics_Body *body, EPhysics_Quaternion *quat)
ephysics_body_activate(body, EINA_TRUE);
bt_quat = btQuaternion(x, y, z, w);
+ trans = _ephysics_body_transform_get(body);
+ trans.setRotation(bt_quat);
if (body->soft_body)
- body->soft_body->rotate(bt_quat);
+ _ephysics_body_soft_body_rotation_set(body, trans);
else
{
- trans = _ephysics_body_transform_get(body);
- trans.setRotation(bt_quat);
body->rigid_body->proceedToTransform(trans);
body->rigid_body->getMotionState()->setWorldTransform(trans);
}