summaryrefslogtreecommitdiff
path: root/legacy/ephysics
diff options
context:
space:
mode:
authorBruno Dilly <bdilly@profusion.mobi>2012-10-10 19:16:43 +0000
committerBruno Dilly <bdilly@profusion.mobi>2012-10-10 19:16:43 +0000
commit4ef1a74d4cff57d0bf3148d5f01bdbb8df4a352d (patch)
tree7db4022f3f1953f2cd59148cb0aca87173fc9efd /legacy/ephysics
parentf8136287ada170c0abaa27b02234c8945def4025 (diff)
ephysics: support enabling moves on z axis
SVN revision: 77774
Diffstat (limited to 'legacy/ephysics')
-rw-r--r--legacy/ephysics/src/lib/EPhysics.h14
-rw-r--r--legacy/ephysics/src/lib/ephysics_body.cpp8
2 files changed, 14 insertions, 8 deletions
diff --git a/legacy/ephysics/src/lib/EPhysics.h b/legacy/ephysics/src/lib/EPhysics.h
index 4e2ad48bae..febc01a3fa 100644
--- a/legacy/ephysics/src/lib/EPhysics.h
+++ b/legacy/ephysics/src/lib/EPhysics.h
@@ -2723,39 +2723,43 @@ EAPI Eina_Bool ephysics_body_rotation_on_z_axis_enable_get(const EPhysics_Body *
2723 2723
2724/** 2724/**
2725 * @brief 2725 * @brief
2726 * Enable or disable body's movement on x and y axes. 2726 * Enable or disable body's movement on x, y and z axes.
2727 * 2727 *
2728 * Enabled by default on both axes. 2728 * Enabled by default on x and y axes, disabled on z axis.
2729 * 2729 *
2730 * @param body The physics body. 2730 * @param body The physics body.
2731 * @param enable_x If @c EINA_TRUE allow movement on x axis, if @c EINA_FALSE 2731 * @param enable_x If @c EINA_TRUE allow movement on x axis, if @c EINA_FALSE
2732 * disallow it. 2732 * disallow it.
2733 * @param enable_y If @c EINA_TRUE allow movement on y axis, if @c EINA_FALSE 2733 * @param enable_y If @c EINA_TRUE allow movement on y axis, if @c EINA_FALSE
2734 * disallow it. 2734 * disallow it.
2735 * @param enable_z If @c EINA_TRUE allow movement on z axis, if @c EINA_FALSE
2736 * disallow it.
2735 * 2737 *
2736 * @see ephysics_body_linear_movement_enable_get(). 2738 * @see ephysics_body_linear_movement_enable_get().
2737 * @see ephysics_body_rotation_on_z_axis_enable_set(). 2739 * @see ephysics_body_rotation_on_z_axis_enable_set().
2738 * 2740 *
2739 * @ingroup EPhysics_Body 2741 * @ingroup EPhysics_Body
2740 */ 2742 */
2741EAPI void ephysics_body_linear_movement_enable_set(EPhysics_Body *body, Eina_Bool enable_x, Eina_Bool enable_y); 2743EAPI void ephysics_body_linear_movement_enable_set(EPhysics_Body *body, Eina_Bool enable_x, Eina_Bool enable_y, Eina_Bool enable_z);
2742 2744
2743/** 2745/**
2744 * @brief 2746 * @brief
2745 * Get body's movement on x and y axes behavior. 2747 * Get body's movement on x, y and z axes behavior.
2746 * 2748 *
2747 * @param body The physics body. 2749 * @param body The physics body.
2748 * @param enable_x @c EINA_TRUE if movement on x axis is allowed, or 2750 * @param enable_x @c EINA_TRUE if movement on x axis is allowed, or
2749 * @c EINA_FALSE if it's not. 2751 * @c EINA_FALSE if it's not.
2750 * @param enable_y @c EINA_TRUE if movement on y axis is allowed, or 2752 * @param enable_y @c EINA_TRUE if movement on y axis is allowed, or
2751 * @c EINA_FALSE if it's not. 2753 * @c EINA_FALSE if it's not.
2754 * @param enable_z @c EINA_TRUE if movement on z axis is allowed, or
2755 * @c EINA_FALSE if it's not.
2752 * 2756 *
2753 * @see ephysics_body_linear_movement_enable_set(). 2757 * @see ephysics_body_linear_movement_enable_set().
2754 * @see ephysics_body_rotation_on_z_axis_enable_get(). 2758 * @see ephysics_body_rotation_on_z_axis_enable_get().
2755 * 2759 *
2756 * @ingroup EPhysics_Body 2760 * @ingroup EPhysics_Body
2757 */ 2761 */
2758EAPI void ephysics_body_linear_movement_enable_get(const EPhysics_Body *body, Eina_Bool *enable_x, Eina_Bool *enable_y); 2762EAPI void ephysics_body_linear_movement_enable_get(const EPhysics_Body *body, Eina_Bool *enable_x, Eina_Bool *enable_y, Eina_Bool *enable_z);
2759 2763
2760/** 2764/**
2761 * @brief 2765 * @brief
diff --git a/legacy/ephysics/src/lib/ephysics_body.cpp b/legacy/ephysics/src/lib/ephysics_body.cpp
index d16f9d7954..23120d5959 100644
--- a/legacy/ephysics/src/lib/ephysics_body.cpp
+++ b/legacy/ephysics/src/lib/ephysics_body.cpp
@@ -2439,7 +2439,7 @@ ephysics_body_impulse_apply(EPhysics_Body *body, double x, double y, Evas_Coord
2439} 2439}
2440 2440
2441EAPI void 2441EAPI void
2442ephysics_body_linear_movement_enable_set(EPhysics_Body *body, Eina_Bool enable_x, Eina_Bool enable_y) 2442ephysics_body_linear_movement_enable_set(EPhysics_Body *body, Eina_Bool enable_x, Eina_Bool enable_y, Eina_Bool enable_z)
2443{ 2443{
2444 if (!body) 2444 if (!body)
2445 { 2445 {
@@ -2448,12 +2448,13 @@ ephysics_body_linear_movement_enable_set(EPhysics_Body *body, Eina_Bool enable_x
2448 } 2448 }
2449 2449
2450 ephysics_world_lock_take(body->world); 2450 ephysics_world_lock_take(body->world);
2451 body->rigid_body->setLinearFactor(btVector3(!!enable_x, !!enable_y, 0)); 2451 body->rigid_body->setLinearFactor(btVector3(!!enable_x, !!enable_y,
2452 !!enable_z));
2452 ephysics_world_lock_release(body->world); 2453 ephysics_world_lock_release(body->world);
2453} 2454}
2454 2455
2455EAPI void 2456EAPI void
2456ephysics_body_linear_movement_enable_get(const EPhysics_Body *body, Eina_Bool *enable_x, Eina_Bool *enable_y) 2457ephysics_body_linear_movement_enable_get(const EPhysics_Body *body, Eina_Bool *enable_x, Eina_Bool *enable_y, Eina_Bool *enable_z)
2457{ 2458{
2458 if (!body) 2459 if (!body)
2459 { 2460 {
@@ -2463,6 +2464,7 @@ ephysics_body_linear_movement_enable_get(const EPhysics_Body *body, Eina_Bool *e
2463 2464
2464 if (enable_x) *enable_x = !!body->rigid_body->getLinearFactor().x(); 2465 if (enable_x) *enable_x = !!body->rigid_body->getLinearFactor().x();
2465 if (enable_y) *enable_y = !!body->rigid_body->getLinearFactor().y(); 2466 if (enable_y) *enable_y = !!body->rigid_body->getLinearFactor().y();
2467 if (enable_z) *enable_z = !!body->rigid_body->getLinearFactor().z();
2466} 2468}
2467 2469
2468EAPI void 2470EAPI void