forked from enlightenment/efl
EPhysics: expose linear factor
Makes it possible to restrict movement on specific axises. SVN revision: 73313
This commit is contained in:
parent
c45cfc3be1
commit
9258827a93
|
@ -1520,6 +1520,42 @@ EAPI void ephysics_body_rotation_on_z_axis_enable_set(EPhysics_Body *body, Eina_
|
|||
*/
|
||||
EAPI Eina_Bool ephysics_body_rotation_on_z_axis_enable_get(EPhysics_Body *body);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Enable or disable body's movement on x and y axises.
|
||||
*
|
||||
* Enabled by default on both axises.
|
||||
*
|
||||
* @param body The physics body.
|
||||
* @param enable_x If @c EINA_TRUE allow movement on x axis, if @c EINA_FALSE
|
||||
* disallow it.
|
||||
* @param enable_y If @c EINA_TRUE allow movement on y axis, if @c EINA_FALSE
|
||||
* disallow it.
|
||||
*
|
||||
* @see ephysics_body_linear_movement_enable_set().
|
||||
* @see ephysics_body_rotation_on_z_axis_enable_set().
|
||||
*
|
||||
* @ingroup EPhysics_Body
|
||||
*/
|
||||
EAPI void ephysics_body_linear_movement_enable_set(EPhysics_Body *body, Eina_Bool enable_x, Eina_Bool enable_y);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Get body's movement on x and y axises behavior.
|
||||
*
|
||||
* @param body The physics body.
|
||||
* @param enable_x @c EINA_TRUE if movement on x axis is allowed, or
|
||||
* @c EINA_FALSE if it's not.
|
||||
* @param enable_y @c EINA_TRUE if movement on y axis is allowed, or
|
||||
* @c EINA_FALSE if it's not.
|
||||
*
|
||||
* @see ephysics_body_linear_movement_enable_get().
|
||||
* @see ephysics_body_rotation_on_z_axis_enable_get().
|
||||
*
|
||||
* @ingroup EPhysics_Body
|
||||
*/
|
||||
EAPI void ephysics_body_linear_movement_enable_get(EPhysics_Body *body, Eina_Bool *enable_x, Eina_Bool *enable_y);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Return body's rotation on z axis.
|
||||
|
|
|
@ -820,6 +820,31 @@ ephysics_body_central_impulse_apply(EPhysics_Body *body, double x, double y)
|
|||
body->rigid_body->applyCentralImpulse(btVector3(x, y, 0));
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ephysics_body_linear_movement_enable_set(EPhysics_Body *body, Eina_Bool enable_x, Eina_Bool enable_y)
|
||||
{
|
||||
if (!body)
|
||||
{
|
||||
ERR("Can't set linear factor on a null body.");
|
||||
return;
|
||||
}
|
||||
|
||||
body->rigid_body->setLinearFactor(btVector3(!!enable_x, !!enable_y, 0));
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ephysics_body_linear_movement_enable_get(EPhysics_Body *body, Eina_Bool *enable_x, Eina_Bool *enable_y)
|
||||
{
|
||||
if (!body)
|
||||
{
|
||||
ERR("Can't check if linear factor is enabled, body is null.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (enable_x) *enable_x = !!body->rigid_body->getLinearFactor().x();
|
||||
if (enable_y) *enable_y = !!body->rigid_body->getLinearFactor().y();
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ephysics_body_torque_impulse_apply(EPhysics_Body *body, double roll)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue