summaryrefslogtreecommitdiff
path: root/legacy/ephysics
diff options
context:
space:
mode:
authorBruno Dilly <bdilly@profusion.mobi>2012-10-10 19:17:36 +0000
committerBruno Dilly <bdilly@profusion.mobi>2012-10-10 19:17:36 +0000
commita1897ddf578417e6bca3a193b1839a0355c91b67 (patch)
tree30cfc336fad60dbe3aca364e530bc5e76624074a /legacy/ephysics
parent71583d30e3bf8b32d1b8183ac7b764893aa90b24 (diff)
ephysics: impulses support the 3 planes
SVN revision: 77780
Diffstat (limited to 'legacy/ephysics')
-rw-r--r--legacy/ephysics/src/bin/ephysics_logo.c2
-rw-r--r--legacy/ephysics/src/bin/ephysics_sandbox.c16
-rw-r--r--legacy/ephysics/src/bin/test_bouncing_ball.c8
-rw-r--r--legacy/ephysics/src/bin/test_camera.c2
-rw-r--r--legacy/ephysics/src/bin/test_camera_track.c2
-rw-r--r--legacy/ephysics/src/bin/test_collision_detection.c2
-rw-r--r--legacy/ephysics/src/bin/test_collision_filter.c2
-rw-r--r--legacy/ephysics/src/bin/test_collision_speed.c2
-rw-r--r--legacy/ephysics/src/bin/test_delete.c2
-rw-r--r--legacy/ephysics/src/bin/test_growing_balls.c2
-rw-r--r--legacy/ephysics/src/bin/test_jumping_balls.c2
-rw-r--r--legacy/ephysics/src/bin/test_rotating_forever.c4
-rw-r--r--legacy/ephysics/src/bin/test_slider.c4
-rw-r--r--legacy/ephysics/src/bin/test_velocity.c8
-rw-r--r--legacy/ephysics/src/lib/EPhysics.h15
-rw-r--r--legacy/ephysics/src/lib/ephysics_body.cpp16
16 files changed, 50 insertions, 39 deletions
diff --git a/legacy/ephysics/src/bin/ephysics_logo.c b/legacy/ephysics/src/bin/ephysics_logo.c
index 9a0dc927c1..308b2e8ed8 100644
--- a/legacy/ephysics/src/bin/ephysics_logo.c
+++ b/legacy/ephysics/src/bin/ephysics_logo.c
@@ -266,7 +266,7 @@ elm_main(int argc __UNUSED__, char **argv __UNUSED__)
266 EINA_FALSE, EINA_TRUE); 266 EINA_FALSE, EINA_TRUE);
267 267
268 /* make the "E" logo get into the viewport by applying an horizontal force */ 268 /* make the "E" logo get into the viewport by applying an horizontal force */
269 ephysics_body_central_impulse_apply(letter_body, 390, 0); 269 ephysics_body_central_impulse_apply(letter_body, 390, 0, 0);
270 270
271 elm_run(); 271 elm_run();
272 272
diff --git a/legacy/ephysics/src/bin/ephysics_sandbox.c b/legacy/ephysics/src/bin/ephysics_sandbox.c
index 3710c11d40..b3fbcab43f 100644
--- a/legacy/ephysics/src/bin/ephysics_sandbox.c
+++ b/legacy/ephysics/src/bin/ephysics_sandbox.c
@@ -261,8 +261,8 @@ _body_impulse_x_x_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
261 rel_x = elm_spinner_value_get(evas_object_data_get(obj, "relx")); 261 rel_x = elm_spinner_value_get(evas_object_data_get(obj, "relx"));
262 rel_y = elm_spinner_value_get(evas_object_data_get(obj, "rely")); 262 rel_y = elm_spinner_value_get(evas_object_data_get(obj, "rely"));
263 263
264 ephysics_body_impulse_apply(body, elm_spinner_value_get(obj), y, rel_x, 264 ephysics_body_impulse_apply(body, elm_spinner_value_get(obj), y, 0,
265 rel_y); 265 rel_x, rel_y, 0);
266} 266}
267 267
268static void 268static void
@@ -280,7 +280,8 @@ _body_impulse_x_rel_cb(void *data, Evas_Object *obj,
280 y = elm_spinner_value_get(evas_object_data_get(aux, "y")); 280 y = elm_spinner_value_get(evas_object_data_get(aux, "y"));
281 rel_y = elm_spinner_value_get(evas_object_data_get(aux, "rely")); 281 rel_y = elm_spinner_value_get(evas_object_data_get(aux, "rely"));
282 282
283 ephysics_body_impulse_apply(body, x, y, elm_spinner_value_get(obj), rel_y); 283 ephysics_body_impulse_apply(body, x, y, 0,
284 elm_spinner_value_get(obj), rel_y, 0);
284} 285}
285 286
286static void 287static void
@@ -297,8 +298,8 @@ _body_impulse_y_y_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
297 rel_x = elm_spinner_value_get(evas_object_data_get(aux, "relx")); 298 rel_x = elm_spinner_value_get(evas_object_data_get(aux, "relx"));
298 rel_y = elm_spinner_value_get(evas_object_data_get(aux, "rely")); 299 rel_y = elm_spinner_value_get(evas_object_data_get(aux, "rely"));
299 300
300 ephysics_body_impulse_apply(body, x, elm_spinner_value_get(obj), rel_x, 301 ephysics_body_impulse_apply(body, x, elm_spinner_value_get(obj), 0,
301 rel_y); 302 rel_x, rel_y, 0);
302} 303}
303 304
304static void 305static void
@@ -316,7 +317,8 @@ _body_impulse_y_rel_cb(void *data, Evas_Object *obj,
316 y = elm_spinner_value_get(evas_object_data_get(aux, "y")); 317 y = elm_spinner_value_get(evas_object_data_get(aux, "y"));
317 rel_x = elm_spinner_value_get(evas_object_data_get(aux, "relx")); 318 rel_x = elm_spinner_value_get(evas_object_data_get(aux, "relx"));
318 319
319 ephysics_body_impulse_apply(body, x, y, rel_x, elm_spinner_value_get(obj)); 320 ephysics_body_impulse_apply(body, x, y, 0,
321 rel_x, 0, elm_spinner_value_get(obj));
320} 322}
321 323
322static void 324static void
@@ -715,7 +717,7 @@ _sandie_body_add(Evas_Object *win, EPhysics_World *world, int x, int y)
715 body = ephysics_body_circle_add(world); 717 body = ephysics_body_circle_add(world);
716 ephysics_body_evas_object_set(body, body_image, EINA_TRUE); 718 ephysics_body_evas_object_set(body, body_image, EINA_TRUE);
717 ephysics_body_mass_set(body, 20); 719 ephysics_body_mass_set(body, 20);
718 ephysics_body_central_impulse_apply(body, 8201, 2110); 720 ephysics_body_central_impulse_apply(body, 8201, 2110, 0);
719 ephysics_body_event_callback_add(body, EPHYSICS_CALLBACK_BODY_DEL, 721 ephysics_body_event_callback_add(body, EPHYSICS_CALLBACK_BODY_DEL,
720 _body_del, NULL); 722 _body_del, NULL);
721 723
diff --git a/legacy/ephysics/src/bin/test_bouncing_ball.c b/legacy/ephysics/src/bin/test_bouncing_ball.c
index beb87e04ba..7ba51b0680 100644
--- a/legacy/ephysics/src/bin/test_bouncing_ball.c
+++ b/legacy/ephysics/src/bin/test_bouncing_ball.c
@@ -14,13 +14,13 @@ _on_keydown(void *data, Evas_Object *obj __UNUSED__, Evas_Object *src __UNUSED__
14 return EINA_FALSE; 14 return EINA_FALSE;
15 15
16 if (strcmp(ev->keyname, "Up") == 0) 16 if (strcmp(ev->keyname, "Up") == 0)
17 ephysics_body_central_impulse_apply(body, 0, -300); 17 ephysics_body_central_impulse_apply(body, 0, -300, 0);
18 else if (strcmp(ev->keyname, "Down") == 0) 18 else if (strcmp(ev->keyname, "Down") == 0)
19 ephysics_body_central_impulse_apply(body, 0, 300); 19 ephysics_body_central_impulse_apply(body, 0, 300, 0);
20 else if (strcmp(ev->keyname, "Right") == 0) 20 else if (strcmp(ev->keyname, "Right") == 0)
21 ephysics_body_central_impulse_apply(body, 300, 0); 21 ephysics_body_central_impulse_apply(body, 300, 0, 0);
22 else if (strcmp(ev->keyname, "Left") == 0) 22 else if (strcmp(ev->keyname, "Left") == 0)
23 ephysics_body_central_impulse_apply(body, -300, 0); 23 ephysics_body_central_impulse_apply(body, -300, 0, 0);
24 24
25 return EINA_TRUE; 25 return EINA_TRUE;
26} 26}
diff --git a/legacy/ephysics/src/bin/test_camera.c b/legacy/ephysics/src/bin/test_camera.c
index f542a1d9d2..2c9adb6187 100644
--- a/legacy/ephysics/src/bin/test_camera.c
+++ b/legacy/ephysics/src/bin/test_camera.c
@@ -103,7 +103,7 @@ _world_populate(Camera_Data *camera_data)
103 update_object_cb, shadow); 103 update_object_cb, shadow);
104 camera_data->base.bodies = eina_list_append(camera_data->base.bodies, 104 camera_data->base.bodies = eina_list_append(camera_data->base.bodies,
105 fall_body); 105 fall_body);
106 ephysics_body_central_impulse_apply(fall_body, 300, 0); 106 ephysics_body_central_impulse_apply(fall_body, 300, 0, 0);
107 107
108 shadow = elm_layout_add(camera_data->base.win); 108 shadow = elm_layout_add(camera_data->base.win);
109 elm_layout_file_set( 109 elm_layout_file_set(
diff --git a/legacy/ephysics/src/bin/test_camera_track.c b/legacy/ephysics/src/bin/test_camera_track.c
index 2e482f1422..631bf72fdc 100644
--- a/legacy/ephysics/src/bin/test_camera_track.c
+++ b/legacy/ephysics/src/bin/test_camera_track.c
@@ -131,7 +131,7 @@ _world_populate(Track_Data *track_data)
131 ephysics_body_restitution_set(body, 0.95); 131 ephysics_body_restitution_set(body, 0.95);
132 ephysics_body_friction_set(body, 1); 132 ephysics_body_friction_set(body, 1);
133 ephysics_body_damping_set(body, 0.1, 0); 133 ephysics_body_damping_set(body, 0.1, 0);
134 ephysics_body_central_impulse_apply(body, 90, 0); 134 ephysics_body_central_impulse_apply(body, 90, 0, 0);
135 track_data->body = body; 135 track_data->body = body;
136 track_data->base.bodies = eina_list_append(track_data->base.bodies, body); 136 track_data->base.bodies = eina_list_append(track_data->base.bodies, body);
137} 137}
diff --git a/legacy/ephysics/src/bin/test_collision_detection.c b/legacy/ephysics/src/bin/test_collision_detection.c
index 6aa8d83beb..b5a4359640 100644
--- a/legacy/ephysics/src/bin/test_collision_detection.c
+++ b/legacy/ephysics/src/bin/test_collision_detection.c
@@ -95,7 +95,7 @@ _world_populate(Collision_Data *collision_data)
95 update_object_cb, sh2); 95 update_object_cb, sh2);
96 ephysics_body_restitution_set(sphere_body2, 1); 96 ephysics_body_restitution_set(sphere_body2, 1);
97 ephysics_body_friction_set(sphere_body2, 0.4); 97 ephysics_body_friction_set(sphere_body2, 0.4);
98 ephysics_body_central_impulse_apply(sphere_body2, 360, 0); 98 ephysics_body_central_impulse_apply(sphere_body2, 360, 0, 0);
99 collision_data->sphere2 = sphere_body2; 99 collision_data->sphere2 = sphere_body2;
100 collision_data->base.bodies = eina_list_append( 100 collision_data->base.bodies = eina_list_append(
101 collision_data->base.bodies, sphere_body2); 101 collision_data->base.bodies, sphere_body2);
diff --git a/legacy/ephysics/src/bin/test_collision_filter.c b/legacy/ephysics/src/bin/test_collision_filter.c
index 5df2ea5112..4759b6103f 100644
--- a/legacy/ephysics/src/bin/test_collision_filter.c
+++ b/legacy/ephysics/src/bin/test_collision_filter.c
@@ -35,7 +35,7 @@ _world_populate(Test_Data *test_data)
35 ephysics_body_friction_set(fall_body, 0.1); 35 ephysics_body_friction_set(fall_body, 0.1);
36 ephysics_body_collision_group_add(fall_body, colors[row]); 36 ephysics_body_collision_group_add(fall_body, colors[row]);
37 if (column + row == 1) 37 if (column + row == 1)
38 ephysics_body_central_impulse_apply(fall_body, 600 * row - 300, 0); 38 ephysics_body_central_impulse_apply(fall_body, 600 * row - 300, 0, 0);
39 test_data->bodies = eina_list_append(test_data->bodies, fall_body); 39 test_data->bodies = eina_list_append(test_data->bodies, fall_body);
40 } 40 }
41} 41}
diff --git a/legacy/ephysics/src/bin/test_collision_speed.c b/legacy/ephysics/src/bin/test_collision_speed.c
index 42f5c230df..6c4ce25a4b 100644
--- a/legacy/ephysics/src/bin/test_collision_speed.c
+++ b/legacy/ephysics/src/bin/test_collision_speed.c
@@ -23,7 +23,7 @@ _shoot(void *data, Evas_Object *obj, void *event_info __UNUSED__)
23 impulse = elm_spinner_value_get(speed_data->sp); 23 impulse = elm_spinner_value_get(speed_data->sp);
24 24
25 elm_object_disabled_set(obj, EINA_TRUE); 25 elm_object_disabled_set(obj, EINA_TRUE);
26 ephysics_body_central_impulse_apply(speed_data->ball, impulse * rate, 0); 26 ephysics_body_central_impulse_apply(speed_data->ball, impulse * rate, 0, 0);
27} 27}
28 28
29static void 29static void
diff --git a/legacy/ephysics/src/bin/test_delete.c b/legacy/ephysics/src/bin/test_delete.c
index 84a85f1a0f..781910bb32 100644
--- a/legacy/ephysics/src/bin/test_delete.c
+++ b/legacy/ephysics/src/bin/test_delete.c
@@ -114,7 +114,7 @@ _world_populate(Collision_Data *collision_data)
114 update_object_cb, sh2); 114 update_object_cb, sh2);
115 ephysics_body_restitution_set(sphere_body2, 1); 115 ephysics_body_restitution_set(sphere_body2, 1);
116 ephysics_body_friction_set(sphere_body2, 0.4); 116 ephysics_body_friction_set(sphere_body2, 0.4);
117 ephysics_body_central_impulse_apply(sphere_body2, 360, 0); 117 ephysics_body_central_impulse_apply(sphere_body2, 360, 0, 0);
118 collision_data->sphere2 = sphere_body2; 118 collision_data->sphere2 = sphere_body2;
119 collision_data->base.bodies = eina_list_append( 119 collision_data->base.bodies = eina_list_append(
120 collision_data->base.bodies, sphere_body2); 120 collision_data->base.bodies, sphere_body2);
diff --git a/legacy/ephysics/src/bin/test_growing_balls.c b/legacy/ephysics/src/bin/test_growing_balls.c
index 8770f91717..cc246ad605 100644
--- a/legacy/ephysics/src/bin/test_growing_balls.c
+++ b/legacy/ephysics/src/bin/test_growing_balls.c
@@ -44,7 +44,7 @@ _add_sphere(Test_Data *test_data, const char *group, int size, int x, int y)
44 sphere_body = ephysics_body_circle_add(test_data->world); 44 sphere_body = ephysics_body_circle_add(test_data->world);
45 ephysics_body_evas_object_set(sphere_body, sphere, EINA_TRUE); 45 ephysics_body_evas_object_set(sphere_body, sphere, EINA_TRUE);
46 ephysics_body_restitution_set(sphere_body, 0.5); 46 ephysics_body_restitution_set(sphere_body, 0.5);
47 ephysics_body_central_impulse_apply(sphere_body, 300, 0); 47 ephysics_body_central_impulse_apply(sphere_body, 300, 0, 0);
48 test_data->bodies = eina_list_append(test_data->bodies, sphere_body); 48 test_data->bodies = eina_list_append(test_data->bodies, sphere_body);
49} 49}
50 50
diff --git a/legacy/ephysics/src/bin/test_jumping_balls.c b/legacy/ephysics/src/bin/test_jumping_balls.c
index 3d6a54dad2..0bd15f7495 100644
--- a/legacy/ephysics/src/bin/test_jumping_balls.c
+++ b/legacy/ephysics/src/bin/test_jumping_balls.c
@@ -23,7 +23,7 @@ _jump(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
23 elm_object_disabled_set(bt, EINA_TRUE); 23 elm_object_disabled_set(bt, EINA_TRUE);
24 bodies = ephysics_world_bodies_get(world); 24 bodies = ephysics_world_bodies_get(world);
25 EINA_LIST_FOREACH(bodies, l, body) 25 EINA_LIST_FOREACH(bodies, l, body)
26 ephysics_body_central_impulse_apply(body, 0, -300); 26 ephysics_body_central_impulse_apply(body, 0, -300, 0);
27 eina_list_free(bodies); 27 eina_list_free(bodies);
28} 28}
29 29
diff --git a/legacy/ephysics/src/bin/test_rotating_forever.c b/legacy/ephysics/src/bin/test_rotating_forever.c
index 40c2a0c77e..11cc77158d 100644
--- a/legacy/ephysics/src/bin/test_rotating_forever.c
+++ b/legacy/ephysics/src/bin/test_rotating_forever.c
@@ -99,7 +99,7 @@ _world_populate(Test_Data *test_data)
99 EPHYSICS_CALLBACK_BODY_UPDATE, 99 EPHYSICS_CALLBACK_BODY_UPDATE,
100 _update_object_cb, NULL); 100 _update_object_cb, NULL);
101 101
102 ephysics_body_torque_impulse_apply(body, 1); 102 ephysics_body_torque_impulse_apply(body, 0, 0, 1);
103 103
104 cube = elm_image_add(test_data->win); 104 cube = elm_image_add(test_data->win);
105 elm_image_file_set( 105 elm_image_file_set(
@@ -116,7 +116,7 @@ _world_populate(Test_Data *test_data)
116 EPHYSICS_CALLBACK_BODY_UPDATE, 116 EPHYSICS_CALLBACK_BODY_UPDATE,
117 _update_object_cb, NULL); 117 _update_object_cb, NULL);
118 118
119 ephysics_body_impulse_apply(body, 30, 0, 0, -10); 119 ephysics_body_impulse_apply(body, 30, 0, 0, 0, -10, 0);
120 120
121 cube = elm_image_add(test_data->win); 121 cube = elm_image_add(test_data->win);
122 elm_image_file_set( 122 elm_image_file_set(
diff --git a/legacy/ephysics/src/bin/test_slider.c b/legacy/ephysics/src/bin/test_slider.c
index f2c49cef13..3dea4a0bf0 100644
--- a/legacy/ephysics/src/bin/test_slider.c
+++ b/legacy/ephysics/src/bin/test_slider.c
@@ -94,7 +94,7 @@ _world_populate(Test_Data *test_data)
94 constraint = ephysics_constraint_slider_add(box_body3); 94 constraint = ephysics_constraint_slider_add(box_body3);
95 ephysics_constraint_slider_linear_limit_set(constraint, WIDTH - 120, 0, 0, 95 ephysics_constraint_slider_linear_limit_set(constraint, WIDTH - 120, 0, 0,
96 0); 96 0);
97 ephysics_body_central_impulse_apply(box_body3, -240, 0); 97 ephysics_body_central_impulse_apply(box_body3, -240, 0, 0);
98 test_data->constraints = eina_list_append(test_data->constraints, 98 test_data->constraints = eina_list_append(test_data->constraints,
99 constraint); 99 constraint);
100 100
@@ -124,7 +124,7 @@ _world_populate(Test_Data *test_data)
124 124
125 constraint = ephysics_constraint_slider_add(box_body4); 125 constraint = ephysics_constraint_slider_add(box_body4);
126 ephysics_constraint_slider_linear_limit_set(constraint, WIDTH / 3, 0, 0, 0); 126 ephysics_constraint_slider_linear_limit_set(constraint, WIDTH / 3, 0, 0, 0);
127 ephysics_body_central_impulse_apply(box_body4, -600, 0); 127 ephysics_body_central_impulse_apply(box_body4, -600, 0, 0);
128 test_data->constraints = eina_list_append(test_data->constraints, 128 test_data->constraints = eina_list_append(test_data->constraints,
129 constraint); 129 constraint);
130 130
diff --git a/legacy/ephysics/src/bin/test_velocity.c b/legacy/ephysics/src/bin/test_velocity.c
index 1862bb7412..e2149d7834 100644
--- a/legacy/ephysics/src/bin/test_velocity.c
+++ b/legacy/ephysics/src/bin/test_velocity.c
@@ -25,13 +25,13 @@ _on_keydown(void *data, Evas_Object *obj __UNUSED__, Evas_Object *src __UNUSED__
25 return EINA_FALSE; 25 return EINA_FALSE;
26 26
27 if (strcmp(ev->keyname, "Up") == 0) 27 if (strcmp(ev->keyname, "Up") == 0)
28 ephysics_body_central_impulse_apply(body, 0, -300); 28 ephysics_body_central_impulse_apply(body, 0, -300, 0);
29 else if (strcmp(ev->keyname, "Down") == 0) 29 else if (strcmp(ev->keyname, "Down") == 0)
30 ephysics_body_central_impulse_apply(body, 0, 300); 30 ephysics_body_central_impulse_apply(body, 0, 300, 0);
31 else if (strcmp(ev->keyname, "Right") == 0) 31 else if (strcmp(ev->keyname, "Right") == 0)
32 ephysics_body_central_impulse_apply(body, 300, 0); 32 ephysics_body_central_impulse_apply(body, 300, 0, 0);
33 else if (strcmp(ev->keyname, "Left") == 0) 33 else if (strcmp(ev->keyname, "Left") == 0)
34 ephysics_body_central_impulse_apply(body, -300, 0); 34 ephysics_body_central_impulse_apply(body, -300, 0, 0);
35 35
36 return EINA_TRUE; 36 return EINA_TRUE;
37} 37}
diff --git a/legacy/ephysics/src/lib/EPhysics.h b/legacy/ephysics/src/lib/EPhysics.h
index 99bd96e126..63526c28e9 100644
--- a/legacy/ephysics/src/lib/EPhysics.h
+++ b/legacy/ephysics/src/lib/EPhysics.h
@@ -2626,7 +2626,7 @@ EAPI double ephysics_body_friction_get(const EPhysics_Body *body);
2626 * After a impulse of 30 kg * p / s in the same direction is applied, 2626 * After a impulse of 30 kg * p / s in the same direction is applied,
2627 * the velocity will be * 45 p/s. 2627 * the velocity will be * 45 p/s.
2628 * 2628 *
2629 * (0, 30) + (0, 300) / 2 = (0, 30) + (0, 15) = (0, 45) 2629 * (0, 30, 0) + (0, 300, 0) / 2 = (0, 30, 0) + (0, 15, 0) = (0, 45, 0)
2630 * 2630 *
2631 * When a impulse is applied over a body, it will has its velocity changed. 2631 * When a impulse is applied over a body, it will has its velocity changed.
2632 * This impulse will be applied on body's center, so it won't implies in 2632 * This impulse will be applied on body's center, so it won't implies in
@@ -2638,13 +2638,14 @@ EAPI double ephysics_body_friction_get(const EPhysics_Body *body);
2638 * @param body The physics body that will receive the impulse. 2638 * @param body The physics body that will receive the impulse.
2639 * @param x The axis x component of impulse. 2639 * @param x The axis x component of impulse.
2640 * @param y The axis y component of impulse. 2640 * @param y The axis y component of impulse.
2641 * @param z The axis z component of impulse.
2641 * 2642 *
2642 * @see ephysics_body_torque_impulse_apply(). 2643 * @see ephysics_body_torque_impulse_apply().
2643 * @see ephysics_body_impulse_apply(). 2644 * @see ephysics_body_impulse_apply().
2644 * 2645 *
2645 * @ingroup EPhysics_Body 2646 * @ingroup EPhysics_Body
2646 */ 2647 */
2647EAPI void ephysics_body_central_impulse_apply(EPhysics_Body *body, double x, double y); 2648EAPI void ephysics_body_central_impulse_apply(EPhysics_Body *body, double x, double y, double z);
2648 2649
2649/** 2650/**
2650 * @brief 2651 * @brief
@@ -2657,6 +2658,10 @@ EAPI void ephysics_body_central_impulse_apply(EPhysics_Body *body, double x, dou
2657 * torque impulse and body's inertia. 2658 * torque impulse and body's inertia.
2658 * 2659 *
2659 * @param body The physics body that will receive the impulse. 2660 * @param body The physics body that will receive the impulse.
2661 * @param pitch Impulse to rotate body around Z axis (rotate on y - z plane).
2662 * Negative values will impulse body on counter clockwise rotation.
2663 * @param yaw Impulse to rotate body around Y axis (rotate on x - z plane).
2664 * Negative values will impulse body on counter clockwise rotation.
2660 * @param roll Impulse to rotate body around Z axis (rotate on x - y plane). 2665 * @param roll Impulse to rotate body around Z axis (rotate on x - y plane).
2661 * Negative values will impulse body on counter clockwise rotation. 2666 * Negative values will impulse body on counter clockwise rotation.
2662 * 2667 *
@@ -2665,7 +2670,7 @@ EAPI void ephysics_body_central_impulse_apply(EPhysics_Body *body, double x, dou
2665 * 2670 *
2666 * @ingroup EPhysics_Body 2671 * @ingroup EPhysics_Body
2667 */ 2672 */
2668EAPI void ephysics_body_torque_impulse_apply(EPhysics_Body *body, double roll); 2673EAPI void ephysics_body_torque_impulse_apply(EPhysics_Body *body, double pitch, double yaw, double roll);
2669 2674
2670/** 2675/**
2671 * @brief 2676 * @brief
@@ -2688,8 +2693,10 @@ EAPI void ephysics_body_torque_impulse_apply(EPhysics_Body *body, double roll);
2688 * @param body The physics body that will receive the impulse. 2693 * @param body The physics body that will receive the impulse.
2689 * @param x The axis x component of impulse. 2694 * @param x The axis x component of impulse.
2690 * @param y The axis y component of impulse. 2695 * @param y The axis y component of impulse.
2696 * @param z The axis z component of impulse.
2691 * @param pos_x The axis x component of the relative position to apply impulse. 2697 * @param pos_x The axis x component of the relative position to apply impulse.
2692 * @param pos_y The axis y component of the relative position to apply impulse. 2698 * @param pos_y The axis y component of the relative position to apply impulse.
2699 * @param pos_z The axis z component of the relative position to apply impulse.
2693 * 2700 *
2694 * @note Impulse is measured in kg * p / s and position in pixels 2701 * @note Impulse is measured in kg * p / s and position in pixels
2695 * (Evas coordinates). 2702 * (Evas coordinates).
@@ -2699,7 +2706,7 @@ EAPI void ephysics_body_torque_impulse_apply(EPhysics_Body *body, double roll);
2699 * 2706 *
2700 * @ingroup EPhysics_Body 2707 * @ingroup EPhysics_Body
2701 */ 2708 */
2702EAPI void ephysics_body_impulse_apply(EPhysics_Body *body, double x, double y, Evas_Coord pos_x, Evas_Coord pos_y); 2709EAPI void ephysics_body_impulse_apply(EPhysics_Body *body, double x, double y, double z, Evas_Coord pos_x, Evas_Coord pos_y, Evas_Coord pos_z);
2703 2710
2704/** 2711/**
2705 * @brief 2712 * @brief
diff --git a/legacy/ephysics/src/lib/ephysics_body.cpp b/legacy/ephysics/src/lib/ephysics_body.cpp
index f3cdd78c3f..a88c073100 100644
--- a/legacy/ephysics/src/lib/ephysics_body.cpp
+++ b/legacy/ephysics/src/lib/ephysics_body.cpp
@@ -2418,7 +2418,7 @@ ephysics_body_world_get(const EPhysics_Body *body)
2418} 2418}
2419 2419
2420EAPI void 2420EAPI void
2421ephysics_body_central_impulse_apply(EPhysics_Body *body, double x, double y) 2421ephysics_body_central_impulse_apply(EPhysics_Body *body, double x, double y, double z)
2422{ 2422{
2423 double rate; 2423 double rate;
2424 2424
@@ -2432,12 +2432,13 @@ ephysics_body_central_impulse_apply(EPhysics_Body *body, double x, double y)
2432 2432
2433 ephysics_world_lock_take(body->world); 2433 ephysics_world_lock_take(body->world);
2434 ephysics_body_activate(body, EINA_TRUE); 2434 ephysics_body_activate(body, EINA_TRUE);
2435 body->rigid_body->applyCentralImpulse(btVector3(x / rate, - y / rate, 0)); 2435 body->rigid_body->applyCentralImpulse(btVector3(x / rate, - y / rate,
2436 z / rate));
2436 ephysics_world_lock_release(body->world); 2437 ephysics_world_lock_release(body->world);
2437} 2438}
2438 2439
2439EAPI void 2440EAPI void
2440ephysics_body_impulse_apply(EPhysics_Body *body, double x, double y, Evas_Coord pos_x, Evas_Coord pos_y) 2441ephysics_body_impulse_apply(EPhysics_Body *body, double x, double y, double z, Evas_Coord pos_x, Evas_Coord pos_y, Evas_Coord pos_z)
2441{ 2442{
2442 double rate; 2443 double rate;
2443 2444
@@ -2451,9 +2452,10 @@ ephysics_body_impulse_apply(EPhysics_Body *body, double x, double y, Evas_Coord
2451 2452
2452 ephysics_world_lock_take(body->world); 2453 ephysics_world_lock_take(body->world);
2453 ephysics_body_activate(body, EINA_TRUE); 2454 ephysics_body_activate(body, EINA_TRUE);
2454 body->rigid_body->applyImpulse(btVector3(x / rate, - y / rate, 0), 2455 body->rigid_body->applyImpulse(btVector3(x / rate, - y / rate, z / rate),
2455 btVector3((double) pos_x / rate, 2456 btVector3((double) pos_x / rate,
2456 (double) pos_y / rate, 0)); 2457 (double) pos_y / rate,
2458 (double) pos_z / rate));
2457 ephysics_world_lock_release(body->world); 2459 ephysics_world_lock_release(body->world);
2458} 2460}
2459 2461
@@ -2487,7 +2489,7 @@ ephysics_body_linear_movement_enable_get(const EPhysics_Body *body, Eina_Bool *e
2487} 2489}
2488 2490
2489EAPI void 2491EAPI void
2490ephysics_body_torque_impulse_apply(EPhysics_Body *body, double roll) 2492ephysics_body_torque_impulse_apply(EPhysics_Body *body, double pitch, double yaw, double roll)
2491{ 2493{
2492 if (!body) 2494 if (!body)
2493 { 2495 {
@@ -2497,7 +2499,7 @@ ephysics_body_torque_impulse_apply(EPhysics_Body *body, double roll)
2497 2499
2498 ephysics_world_lock_take(body->world); 2500 ephysics_world_lock_take(body->world);
2499 ephysics_body_activate(body, EINA_TRUE); 2501 ephysics_body_activate(body, EINA_TRUE);
2500 body->rigid_body->applyTorqueImpulse(btVector3(0, 0, -roll)); 2502 body->rigid_body->applyTorqueImpulse(btVector3(-pitch, -yaw, -roll));
2501 ephysics_world_lock_release(body->world); 2503 ephysics_world_lock_release(body->world);
2502} 2504}
2503 2505