From b5221d07056ca9da715472c79efd5dc15d91f039 Mon Sep 17 00:00:00 2001 From: Bruno Dilly Date: Thu, 16 Aug 2012 21:35:31 +0000 Subject: [PATCH] EPhysics: fix old bug on velocity setter It should invert y component since evas y coords increase going down. SVN revision: 75337 --- legacy/ephysics/src/bin/test_no_gravity.c | 4 ++-- legacy/ephysics/src/lib/ephysics_body.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/legacy/ephysics/src/bin/test_no_gravity.c b/legacy/ephysics/src/bin/test_no_gravity.c index 64b55665b9..5bf65fd892 100644 --- a/legacy/ephysics/src/bin/test_no_gravity.c +++ b/legacy/ephysics/src/bin/test_no_gravity.c @@ -42,7 +42,7 @@ _world_populate(Test_Data *test_data) update_object_cb, sh1); ephysics_body_restitution_set(box_body1, 0.7); ephysics_body_friction_set(box_body1, 0); - ephysics_body_linear_velocity_set(box_body1, -30, -40); + ephysics_body_linear_velocity_set(box_body1, -30, 40); ephysics_body_sleeping_threshold_set(box_body1, 0.1, 0.1); test_data->bodies = eina_list_append(test_data->bodies, box_body1); @@ -68,7 +68,7 @@ _world_populate(Test_Data *test_data) update_object_cb, sh2); ephysics_body_restitution_set(box_body2, 0.7); ephysics_body_friction_set(box_body2, 0); - ephysics_body_linear_velocity_set(box_body2, 40, 30); + ephysics_body_linear_velocity_set(box_body2, 40, -30); ephysics_body_angular_velocity_set(box_body2, 36); ephysics_body_sleeping_threshold_set(box_body2, 0.1, 0.1); test_data->bodies = eina_list_append(test_data->bodies, box_body2); diff --git a/legacy/ephysics/src/lib/ephysics_body.cpp b/legacy/ephysics/src/lib/ephysics_body.cpp index 7677d5584e..828b2eb56c 100644 --- a/legacy/ephysics/src/lib/ephysics_body.cpp +++ b/legacy/ephysics/src/lib/ephysics_body.cpp @@ -36,7 +36,7 @@ _ephysics_body_sleeping_threshold_set(EPhysics_Body *body, double linear_thresho static inline void _ephysics_body_linear_velocity_set(EPhysics_Body *body, double x, double y, double rate) { - body->rigid_body->setLinearVelocity(btVector3(x / rate, y / rate, 0)); + body->rigid_body->setLinearVelocity(btVector3(x / rate, -y / rate, 0)); } static void