summaryrefslogtreecommitdiff
path: root/legacy/ephysics
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
parent154041e62e235b9355157a2bfe68845a1917db6b (diff)
EPhysics: fix soft body rotation_set
--This line, and those below, will be ignored-- SVN revision: 80104
Diffstat (limited to 'legacy/ephysics')
-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 72439aa326..afce7883bc 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
3864 return quat; 3864 return quat;
3865} 3865}
3866 3866
3867static void
3868_ephysics_body_soft_body_rotation_set(EPhysics_Body *body, btTransform trans)
3869{
3870 btSoftBody::Node *node;
3871 const btScalar margin= body->soft_body->getCollisionShape()->getMargin();
3872 ATTRIBUTE_ALIGNED16(btDbvtVolume) vol;
3873
3874 for (int i = 0; i < body->soft_body->m_nodes.size(); i++)
3875 {
3876 node = &body->soft_body->m_nodes[i];
3877 node->m_n = (trans.getBasis() * btVector3(1, 1, 1));
3878 vol = btDbvtVolume::FromCR(node->m_x, margin);
3879
3880 body->soft_body->m_ndbvt.update(node->m_leaf, vol);
3881 }
3882
3883 body->soft_body->updateNormals();
3884 body->soft_body->updateBounds();
3885 body->soft_body->updateConstants();
3886}
3887
3867EAPI void 3888EAPI void
3868ephysics_body_rotation_set(EPhysics_Body *body, EPhysics_Quaternion *quat) 3889ephysics_body_rotation_set(EPhysics_Body *body, EPhysics_Quaternion *quat)
3869{ 3890{
@@ -3889,13 +3910,13 @@ ephysics_body_rotation_set(EPhysics_Body *body, EPhysics_Quaternion *quat)
3889 ephysics_body_activate(body, EINA_TRUE); 3910 ephysics_body_activate(body, EINA_TRUE);
3890 3911
3891 bt_quat = btQuaternion(x, y, z, w); 3912 bt_quat = btQuaternion(x, y, z, w);
3913 trans = _ephysics_body_transform_get(body);
3914 trans.setRotation(bt_quat);
3892 3915
3893 if (body->soft_body) 3916 if (body->soft_body)
3894 body->soft_body->rotate(bt_quat); 3917 _ephysics_body_soft_body_rotation_set(body, trans);
3895 else 3918 else
3896 { 3919 {
3897 trans = _ephysics_body_transform_get(body);
3898 trans.setRotation(bt_quat);
3899 body->rigid_body->proceedToTransform(trans); 3920 body->rigid_body->proceedToTransform(trans);
3900 body->rigid_body->getMotionState()->setWorldTransform(trans); 3921 body->rigid_body->getMotionState()->setWorldTransform(trans);
3901 } 3922 }