summaryrefslogtreecommitdiff
path: root/legacy/ephysics/src/lib/ephysics_body.cpp
diff options
context:
space:
mode:
authorLeandro Dorileo <dorileo@profusion.mobi>2012-12-11 21:11:12 +0000
committerLeandro Dorileo <dorileo@profusion.mobi>2012-12-11 21:11:12 +0000
commit2ccf6d2a119fc3c31851114aa19bef3f42e6e8cf (patch)
tree65e29196ddc5cbda7054233dbea89028b8dc5c2d /legacy/ephysics/src/lib/ephysics_body.cpp
parent2e8fcf0a2351784559d32c01ccbea484f4a0cf55 (diff)
EPhysics: fix issues with force application
This patch fixes the forces apply, the current implementation will never apply it. We're also applying rate twice, get rid of rate on forces_apply function. SVN revision: 80719
Diffstat (limited to '')
-rw-r--r--legacy/ephysics/src/lib/ephysics_body.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/legacy/ephysics/src/lib/ephysics_body.cpp b/legacy/ephysics/src/lib/ephysics_body.cpp
index 5fde811807..576c2b864a 100644
--- a/legacy/ephysics/src/lib/ephysics_body.cpp
+++ b/legacy/ephysics/src/lib/ephysics_body.cpp
@@ -544,6 +544,11 @@ _ephysics_body_forces_update(EPhysics_Body *body)
544 body->force.torque_y = body->rigid_body->getTotalTorque().getY(); 544 body->force.torque_y = body->rigid_body->getTotalTorque().getY();
545 body->force.torque_z = body->rigid_body->getTotalTorque().getZ(); 545 body->force.torque_z = body->rigid_body->getTotalTorque().getZ();
546 body->rigid_body->clearForces(); 546 body->rigid_body->clearForces();
547
548 DBG("forces updated: %lf, %lf, %lf", body->force.x, body->force.y,
549 body->force.z);
550 DBG("torque updated: %lf, %lf, %lf", body->force.torque_x,
551 body->force.torque_y, body->force.torque_z);
547} 552}
548 553
549static inline void 554static inline void
@@ -1683,18 +1688,18 @@ _ephysics_body_outside_render_area_check(EPhysics_Body *body)
1683void 1688void
1684ephysics_body_forces_apply(EPhysics_Body *body) 1689ephysics_body_forces_apply(EPhysics_Body *body)
1685{ 1690{
1686 double rate;
1687
1688 if (!((body->force.x) || (body->force.y) || (body->force.z) || 1691 if (!((body->force.x) || (body->force.y) || (body->force.z) ||
1689 (body->force.torque_x) || (body->force.torque_y) || 1692 (body->force.torque_x) || (body->force.torque_y) ||
1690 (body->force.torque_z))) 1693 (body->force.torque_z)))
1691 return; 1694 return;
1695
1696 DBG("body: %p, applying forces: %lf, %lf, %lf", body, body->force.x,
1697 body->force.y, body->force.z);
1692 1698
1693 rate = ephysics_world_rate_get(body->world);
1694 ephysics_body_activate(body, EINA_TRUE); 1699 ephysics_body_activate(body, EINA_TRUE);
1695 body->rigid_body->applyCentralForce(btVector3(body->force.x / rate, 1700 body->rigid_body->applyCentralForce(btVector3(body->force.x,
1696 body->force.y / rate, 1701 body->force.y,
1697 body->force.z / rate)); 1702 body->force.z));
1698 body->rigid_body->applyTorque(btVector3(body->force.torque_x, 1703 body->rigid_body->applyTorque(btVector3(body->force.torque_x,
1699 body->force.torque_y, 1704 body->force.torque_y,
1700 body->force.torque_z)); 1705 body->force.torque_z));