summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorRicardo de Almeida Gonzaga <ricardo@profusion.mobi>2012-10-17 21:37:00 +0000
committerBruno Dilly <bdilly@profusion.mobi>2012-10-17 21:37:00 +0000
commit7a2e5cbdce646957bba034523a9ae41c2ecaae45 (patch)
tree8adddd1e4da8555889729787d64d486949211745 /legacy
parent477e836db175dfd72bf9487e5e7b4513b96a0121 (diff)
ephysics: adjust example docs based on Z axis enable.
Patch by: Ricardo de Almeida Gonzaga <ricardo@profusion.mobi> SVN revision: 78133
Diffstat (limited to 'legacy')
-rw-r--r--legacy/ephysics/doc/examples.dox59
-rw-r--r--legacy/ephysics/src/bin/test_forces.c11
2 files changed, 37 insertions, 33 deletions
diff --git a/legacy/ephysics/doc/examples.dox b/legacy/ephysics/doc/examples.dox
index dfbf8e4af9..5eff4096e1 100644
--- a/legacy/ephysics/doc/examples.dox
+++ b/legacy/ephysics/doc/examples.dox
@@ -70,17 +70,18 @@
70 * By setting the render geometry you tell ephysics the dimensions of rendered 70 * By setting the render geometry you tell ephysics the dimensions of rendered
71 * area to be take on account by default updates. 71 * area to be take on account by default updates.
72 * 72 *
73 * By default it starts with null x, y, width and height. Initially there's no 73 * By default it starts with null x, y, z, width, height and depth. Initially
74 * physics limits but - as we'll see later in this example - boundaries can be 74 * there's no physics limits but - as we'll see later in this example -
75 * added by issuing either ephysics_body_top_boundary_add(), 75 * boundaries can be added by issuing either ephysics_body_top_boundary_add(),
76 * ephysics_body_bottom_boundary_add(), ephysics_body_left_boundary_add() and 76 * ephysics_body_bottom_boundary_add(), ephysics_body_left_boundary_add() and
77 * ephysics_body_right_boundary_add(). 77 * ephysics_body_right_boundary_add().
78 * 78 *
79 * While setting the worlds render geometry the first parameter is our just 79 * While setting the worlds render geometry the first parameter is our just
80 * created world, the following parameters indicate the x, y, width and height 80 * created world, the following parameters indicate the x, y, z, width, height
81 * of our area of interest. 81 * and depth of our area of interest.
82 * 82 *
83 * @skipline ephysics_world_render_geometry_set 83 * @skip ephysics_world_render_geometry_set
84 * @until DEPTH);
84 * 85 *
85 * @section boundaries Adding boundaries 86 * @section boundaries Adding boundaries
86 * 87 *
@@ -173,16 +174,17 @@
173 * We mainly use the ephysics_body_central_impulse_apply() function. This 174 * We mainly use the ephysics_body_central_impulse_apply() function. This
174 * function applies an inpulse on the center of a body. 175 * function applies an inpulse on the center of a body.
175 * 176 *
176 * Once pressed \<Up> key it applies a central impulse of 0 kilos on X axis and 177 * Once pressed \<Up> key it applies a central impulse of 0 kilos on X axis,
177 * 10 kilos on Y - so the ball is forced up. 178 * 10 kilos on Y and 0 kilos on Z - so the ball is forced up.
178 * 179 *
179 * If \<Down> key has been pressed we apply an impulse of 0 kilos on X axis and 180 * If \<Down> key has been pressed we apply an impulse of 0 kilos on X axis,
180 * -10 on Y - here the ball is forced down. 181 * -10 kilos on Y and 0 kilos on Z - here the ball is forced down.
181 * 182 *
182 * In the case of \<Right> key pressing it's applied an impulse of 10 kilos on X 183 * In the case of \<Right> key pressing it's applied an impulse of 10 kilos on X
183 * axis and 0 kilos on Y - which applies a force to the right side. But if the 184 * axis, 0 kilos on Y and 0 kilos on Z - which applies a force to the right side.
184 * key being pressed is \<Left> the opposite is done, and an impulse of -10 185 * But if the key being pressed is \<Left> the opposite is done, and an impulse
185 * kilos is applied on X and 0 kilos on Y - and the ball is forced to the left. 186 * of -10 kilos is applied on X, 0 kilos on Y and 0 kilos on Z - and the ball is
187 * forced to the left.
186 * 188 *
187 * @skip _on_keydown 189 * @skip _on_keydown
188 * @until } 190 * @until }
@@ -335,7 +337,7 @@
335 * @dontinclude test_camera.c 337 * @dontinclude test_camera.c
336 * 338 *
337 * @skip _camera_move_cb(void *data 339 * @skip _camera_move_cb(void *data
338 * @until &w, NULL); 340 * @until &w, NULL, NULL);
339 * 341 *
340 * Every world has a camera, so here we get this camera used by our 342 * Every world has a camera, so here we get this camera used by our
341 * EPhysics_World. 343 * EPhysics_World.
@@ -609,7 +611,7 @@
609 * @dontinclude test_collision_detection.c 611 * @dontinclude test_collision_detection.c
610 * 612 *
611 * @skip _collision_cb 613 * @skip _collision_cb
612 * @until int x, y; 614 * @until int x, y, z;
613 * 615 *
614 * Now we want to know which body collides with and filter it. 616 * Now we want to know which body collides with and filter it.
615 * 617 *
@@ -905,7 +907,7 @@
905 * Note that in this blue cube we use an offset to apply the force, the two 907 * Note that in this blue cube we use an offset to apply the force, the two
906 * last parameters are responsible to set a relative position to apply the 908 * last parameters are responsible to set a relative position to apply the
907 * force.In other words, the force applied with an offset will make the body 909 * force.In other words, the force applied with an offset will make the body
908 * rotates. Otherwise (0, 0) the force would be applied on the center of the 910 * rotates. Otherwise (0, 0, 0) the force would be applied on the center of the
909 * body, in this case its recomended use the 911 * body, in this case its recomended use the
910 * ephysics_body_central_force_apply(); 912 * ephysics_body_central_force_apply();
911 * 913 *
@@ -1042,8 +1044,8 @@
1042 * @section add-gravity Setting Gravity 1044 * @section add-gravity Setting Gravity
1043 * @dontinclude test_no_gravity.c 1045 * @dontinclude test_no_gravity.c
1044 * 1046 *
1045 * Here we set EPhysics_worlds gravity in 2 axes (x, y) to (0, 0). Gravity 1047 * Here we set gravity on 3 axes (x, y, z) to (0, 0, 0). Gravity will act
1046 * will act over bodies with mass over all the time. 1048 * over bodies with mass over all the time.
1047 * 1049 *
1048 * @skipline ephysics_world_gravity_set 1050 * @skipline ephysics_world_gravity_set
1049 * 1051 *
@@ -1148,7 +1150,8 @@
1148 * @until } 1150 * @until }
1149 * 1151 *
1150 * This function is used to create the body setting its properties. Note that 1152 * This function is used to create the body setting its properties. Note that
1151 * we disable the rotation on Z axis to this letters don't tilt or recline. 1153 * we disable its angular movement (rotation) on Z axis to this letters don't
1154 * tilt or recline.
1152 * @dontinclude ephysics_logo.c 1155 * @dontinclude ephysics_logo.c
1153 * 1156 *
1154 * @skip _letter_body_setup_common(EPhysics_Body *body 1157 * @skip _letter_body_setup_common(EPhysics_Body *body
@@ -1297,9 +1300,9 @@
1297 * axis (rotate on x-y plane). Will make the body rolls on clockwise rotation, 1300 * axis (rotate on x-y plane). Will make the body rolls on clockwise rotation,
1298 * if the value is negative, the impulse will be on counter clockwise. 1301 * if the value is negative, the impulse will be on counter clockwise.
1299 * 1302 *
1300 * @skipline ephysics_body_torque_impulse_apply(body, 1); 1303 * @skipline ephysics_body_torque_impulse_apply(body, 0, 0, 1);
1301 * 1304 *
1302 * For the second body we'll use an offset to apply the force, the two 1305 * For the second body we'll use an offset to apply the force, the three
1303 * last parameters are responsible to set a relative position to apply the 1306 * last parameters are responsible to set a relative position to apply the
1304 * force.In other words, the force applied with an offset will make the body 1307 * force.In other words, the force applied with an offset will make the body
1305 * rotates and move around the other cubes. 1308 * rotates and move around the other cubes.
@@ -1327,7 +1330,7 @@
1327 * initial torque, changing the body angular acceleration and a callback to 1330 * initial torque, changing the body angular acceleration and a callback to
1328 * delete the timers we'll add. 1331 * delete the timers we'll add.
1329 * 1332 *
1330 * @skipline ephysics_body_torque_apply(body, 2 1333 * @skipline ephysics_body_torque_apply(body, 0, 0, 2
1331 * @skipline ephysics_body_event_callback_add(body, 1334 * @skipline ephysics_body_event_callback_add(body,
1332 * @skipline EPHYSICS_CALLBACK_BODY_DEL, 1335 * @skipline EPHYSICS_CALLBACK_BODY_DEL,
1333 * @skipline _del_torque_cb, cube); 1336 * @skipline _del_torque_cb, cube);
@@ -1458,8 +1461,8 @@
1458 * 1461 *
1459 * Note in this part we get the angular and linear velocities. 1462 * Note in this part we get the angular and linear velocities.
1460 * 1463 *
1461 * @skip vaz = ephysics_body 1464 * @skip ephysics_body_angular_velocity_get
1462 * @until &vy); 1465 * @until &vy, NULL);
1463 * 1466 *
1464 * We need to handle the velocity using delta time to have the acceleration 1467 * We need to handle the velocity using delta time to have the acceleration
1465 * on every tick. Check if its the first time to return before shows 1468 * on every tick. Check if its the first time to return before shows
@@ -1555,7 +1558,7 @@
1555 * vertices is possible to create polygons, in this case a pentagon. 1558 * vertices is possible to create polygons, in this case a pentagon.
1556 * 1559 *
1557 * @skip ephysics_shape_point_add(pentagon_shape 1560 * @skip ephysics_shape_point_add(pentagon_shape
1558 * @until , 1); 1561 * @until , 21/35., 1, 1);
1559 * 1562 *
1560 * Here we create a new physics body using a custom shape. The center of mass 1563 * Here we create a new physics body using a custom shape. The center of mass
1561 * will be the center of the shape. Its collision shape will be the convex 1564 * will be the center of the shape. Its collision shape will be the convex
@@ -1576,7 +1579,7 @@
1576 * @dontinclude test_shapes.c 1579 * @dontinclude test_shapes.c
1577 * 1580 *
1578 * @skip ephysics_shape_point_add(hexagon_shape 1581 * @skip ephysics_shape_point_add(hexagon_shape
1579 * @until 18, 60); 1582 * @until 18, 60, 10);
1580 * 1583 *
1581 * Here we finish the example. The full source code can be found at 1584 * Here we finish the example. The full source code can be found at
1582 * @ref test_shapes_c. 1585 * @ref test_shapes_c.
@@ -1754,10 +1757,10 @@
1754 * and pushed back. 1757 * and pushed back.
1755 * 1758 *
1756 * @skip constraint = ephysics_constraint_slider_add(box_body3 1759 * @skip constraint = ephysics_constraint_slider_add(box_body3
1757 * @until box_body3, -240, 0); 1760 * @until box_body3, -240, 0, 0);
1758 * 1761 *
1759 * @skip constraint = ephysics_constraint_slider_add(box_body4 1762 * @skip constraint = ephysics_constraint_slider_add(box_body4
1760 * @until box_body4, -600, 0); 1763 * @until box_body4, -600, 0, 0);
1761 * 1764 *
1762 * Here we finish the example. The full source code can be found at 1765 * Here we finish the example. The full source code can be found at
1763 * @ref test_slider_c. 1766 * @ref test_slider_c.
diff --git a/legacy/ephysics/src/bin/test_forces.c b/legacy/ephysics/src/bin/test_forces.c
index 639c3d7494..44870cc729 100644
--- a/legacy/ephysics/src/bin/test_forces.c
+++ b/legacy/ephysics/src/bin/test_forces.c
@@ -7,16 +7,17 @@
7static void 7static void
8_update_object_cb(void *data __UNUSED__, EPhysics_Body *body, void *event_info __UNUSED__) 8_update_object_cb(void *data __UNUSED__, EPhysics_Body *body, void *event_info __UNUSED__)
9{ 9{
10 double x, y, torque, vx, vy, va; 10 double x, y, z, torque, vx, vy, vz, va;
11 11
12 ephysics_body_evas_object_update(body); 12 ephysics_body_evas_object_update(body);
13 ephysics_body_forces_get(body, &x, &y, NULL); 13 ephysics_body_forces_get(body, &x, &y, &z);
14 ephysics_body_torques_get(body, NULL, NULL, &torque); 14 ephysics_body_torques_get(body, NULL, NULL, &torque);
15 DBG("Body %p, fx: %lf, fy: %lf, torque: %lf", body, x, y, torque); 15 DBG("Body %p, fx: %lf, fy: %lf, fz: %lf, torque: %lf", body, x, y, z,
16 torque);
16 17
17 ephysics_body_linear_velocity_get(body, &vx, &vy, NULL); 18 ephysics_body_linear_velocity_get(body, &vx, &vy, &vz);
18 ephysics_body_angular_velocity_get(body, NULL, NULL, &va); 19 ephysics_body_angular_velocity_get(body, NULL, NULL, &va);
19 DBG("Body %p, vx: %lf, vy: %lf, va: %lf", body, vx, vy, va); 20 DBG("Body %p, vx: %lf, vy: %lf, vz: %lf, va: %lf", body, vx, vy, vz, va);
20} 21}
21 22
22static void 23static void