ephysics: expose volume getter

useful to calculate density given a mass



SVN revision: 78201
This commit is contained in:
Bruno Dilly 2012-10-18 21:23:05 +00:00
parent cc28164d70
commit 64bc76ba49
2 changed files with 27 additions and 0 deletions

View File

@ -3446,6 +3446,23 @@ EAPI void ephysics_body_density_set(EPhysics_Body *body, double density);
*/
EAPI double ephysics_body_density_get(const EPhysics_Body *body);
/**
* @brief
* Get body's volume.
*
* @note The unit of the returned value is meters ^ 3. Not pixels. Useful
* for calculation with mass and density.
*
* @param body The physics body.
* @return the @p body's volume, in meters ^ 3 or -1 on error.
*
* @see ephysics_body_geometry_set().
* @see ephysics_body_geometry_get().
*
* @ingroup EPhysics_Body
*/
EAPI double ephysics_body_volume_get(const EPhysics_Body *body);
/**
* @brief
* Set body's material.

View File

@ -3142,6 +3142,16 @@ ephysics_body_light_get(const EPhysics_Body *body)
return body->light_apply;
}
EAPI double
ephysics_body_volume_get(const EPhysics_Body *body)
{
if (!body)
{
ERR("No body, no volume.");
return -1;
}
return _ephysics_body_volume_get(body);
}
#ifdef __cplusplus
}