aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/ephysics/src/lib
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
parent2e8fcf0a2351784559d32c01ccbea484f4a0cf55 (diff)
downloadefl-2ccf6d2a119fc3c31851114aa19bef3f42e6e8cf.tar.gz
efl-2ccf6d2a119fc3c31851114aa19bef3f42e6e8cf.tar.xz
efl-2ccf6d2a119fc3c31851114aa19bef3f42e6e8cf.zip
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 'legacy/ephysics/src/lib')
-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 5fde81180..576c2b864 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)
body->force.torque_y = body->rigid_body->getTotalTorque().getY();
body->force.torque_z = body->rigid_body->getTotalTorque().getZ();
body->rigid_body->clearForces();
+
+ DBG("forces updated: %lf, %lf, %lf", body->force.x, body->force.y,
+ body->force.z);
+ DBG("torque updated: %lf, %lf, %lf", body->force.torque_x,
+ body->force.torque_y, body->force.torque_z);
}
static inline void
@@ -1683,18 +1688,18 @@ _ephysics_body_outside_render_area_check(EPhysics_Body *body)
void
ephysics_body_forces_apply(EPhysics_Body *body)
{
- double rate;
-
if (!((body->force.x) || (body->force.y) || (body->force.z) ||
(body->force.torque_x) || (body->force.torque_y) ||
(body->force.torque_z)))
- return;
+ return;
+
+ DBG("body: %p, applying forces: %lf, %lf, %lf", body, body->force.x,
+ body->force.y, body->force.z);
- rate = ephysics_world_rate_get(body->world);
ephysics_body_activate(body, EINA_TRUE);
- body->rigid_body->applyCentralForce(btVector3(body->force.x / rate,
- body->force.y / rate,
- body->force.z / rate));
+ body->rigid_body->applyCentralForce(btVector3(body->force.x,
+ body->force.y,
+ body->force.z));
body->rigid_body->applyTorque(btVector3(body->force.torque_x,
body->force.torque_y,
body->force.torque_z));