forked from enlightenment/efl
EPhysics: implement body velocity get
Implementation of functions for retrieving both the linear and angular velocity on x, y and z axis. Patch by Leandro Dorileo <dorileo@profusion.mobi> SVN revision: 73182
This commit is contained in:
parent
ef1660849b
commit
dfd91827ee
|
@ -968,6 +968,33 @@ EAPI void ephysics_body_mass_set(EPhysics_Body *body, double mass);
|
||||||
*/
|
*/
|
||||||
EAPI double ephysics_body_mass_get(const EPhysics_Body *body);
|
EAPI double ephysics_body_mass_get(const EPhysics_Body *body);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
* Get body's linear velocity on x and y axis.
|
||||||
|
*
|
||||||
|
* @param body The physics body.
|
||||||
|
* @param x The linear velocity on axis x.
|
||||||
|
* @param y The linear velocity on axis y.
|
||||||
|
*
|
||||||
|
* @see ephysics_body_angular_velocity_get().
|
||||||
|
*
|
||||||
|
* @ingroup EPhysics_Body
|
||||||
|
*/
|
||||||
|
EAPI void ephysics_body_linear_velocity_get(const EPhysics_Body *body, double *x, double *y);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
* Get body's angular velocity on z axis.
|
||||||
|
*
|
||||||
|
* @param body The physics body.
|
||||||
|
* @param z The angular velocity on axis z.
|
||||||
|
*
|
||||||
|
* @see ephysics_body_linear_velocity_get().
|
||||||
|
*
|
||||||
|
* @ingroup EPhysics_Body
|
||||||
|
*/
|
||||||
|
EAPI void ephysics_body_angular_velocity_get(const EPhysics_Body *body, double *z);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
* Update the evas object associated to the body.
|
* Update the evas object associated to the body.
|
||||||
|
|
|
@ -547,6 +547,31 @@ ephysics_body_mass_get(const EPhysics_Body *body)
|
||||||
return 1 / body->rigid_body->getInvMass();
|
return 1 / body->rigid_body->getInvMass();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
ephysics_body_linear_velocity_get(const EPhysics_Body *body, double *x, double *y)
|
||||||
|
{
|
||||||
|
if (!body)
|
||||||
|
{
|
||||||
|
ERR("Can't get body linear velocity, body is null.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x) *x = body->rigid_body->getLinearVelocity().getX();
|
||||||
|
if (y) *y = body->rigid_body->getLinearVelocity().getY();
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
ephysics_body_angular_velocity_get(const EPhysics_Body *body, double *z)
|
||||||
|
{
|
||||||
|
if (!body)
|
||||||
|
{
|
||||||
|
ERR("Can't get body linear velocity, body is null.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (z) *z = body->rigid_body->getAngularVelocity().getZ();
|
||||||
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
ephysics_body_evas_object_update(EPhysics_Body *body)
|
ephysics_body_evas_object_update(EPhysics_Body *body)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue