summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorBruno Dilly <bdilly@profusion.mobi>2012-10-18 21:23:05 +0000
committerBruno Dilly <bdilly@profusion.mobi>2012-10-18 21:23:05 +0000
commit64bc76ba49c73d16425d84317bfd38c1e697e901 (patch)
tree34a62ace36788966f722346cefd140cca656b36a /legacy
parentcc28164d70f130612f7494fdec41885fc8d7938c (diff)
ephysics: expose volume getter
useful to calculate density given a mass SVN revision: 78201
Diffstat (limited to 'legacy')
-rw-r--r--legacy/ephysics/src/lib/EPhysics.h17
-rw-r--r--legacy/ephysics/src/lib/ephysics_body.cpp10
2 files changed, 27 insertions, 0 deletions
diff --git a/legacy/ephysics/src/lib/EPhysics.h b/legacy/ephysics/src/lib/EPhysics.h
index 3f9035fe75..f81c3d76e2 100644
--- a/legacy/ephysics/src/lib/EPhysics.h
+++ b/legacy/ephysics/src/lib/EPhysics.h
@@ -3448,6 +3448,23 @@ EAPI double ephysics_body_density_get(const EPhysics_Body *body);
3448 3448
3449/** 3449/**
3450 * @brief 3450 * @brief
3451 * Get body's volume.
3452 *
3453 * @note The unit of the returned value is meters ^ 3. Not pixels. Useful
3454 * for calculation with mass and density.
3455 *
3456 * @param body The physics body.
3457 * @return the @p body's volume, in meters ^ 3 or -1 on error.
3458 *
3459 * @see ephysics_body_geometry_set().
3460 * @see ephysics_body_geometry_get().
3461 *
3462 * @ingroup EPhysics_Body
3463 */
3464EAPI double ephysics_body_volume_get(const EPhysics_Body *body);
3465
3466/**
3467 * @brief
3451 * Set body's material. 3468 * Set body's material.
3452 * 3469 *
3453 * This function makes properties setting easy. When a material is set to 3470 * This function makes properties setting easy. When a material is set to
diff --git a/legacy/ephysics/src/lib/ephysics_body.cpp b/legacy/ephysics/src/lib/ephysics_body.cpp
index 0b25536eda..d50558eaf1 100644
--- a/legacy/ephysics/src/lib/ephysics_body.cpp
+++ b/legacy/ephysics/src/lib/ephysics_body.cpp
@@ -3142,6 +3142,16 @@ ephysics_body_light_get(const EPhysics_Body *body)
3142 return body->light_apply; 3142 return body->light_apply;
3143} 3143}
3144 3144
3145EAPI double
3146ephysics_body_volume_get(const EPhysics_Body *body)
3147{
3148 if (!body)
3149 {
3150 ERR("No body, no volume.");
3151 return -1;
3152 }
3153 return _ephysics_body_volume_get(body);
3154}
3145 3155
3146#ifdef __cplusplus 3156#ifdef __cplusplus
3147} 3157}