EPhysics: add missing damping getter
authorBruno Dilly <bdilly@profusion.mobi>
Thu, 5 Jul 2012 22:53:56 +0000 (22:53 +0000)
committerBruno Dilly <bdilly@profusion.mobi>
Thu, 5 Jul 2012 22:53:56 +0000 (22:53 +0000)
SVN revision: 73386

legacy/ephysics/src/lib/EPhysics.h
legacy/ephysics/src/lib/ephysics_body.cpp

index bcce72d..e7ebccd 100644 (file)
@@ -1316,8 +1316,10 @@ EAPI void ephysics_body_stop(EPhysics_Body *body);
  * factor.
  *
  * @param body The physics body.
- * @param linear_damping The linear damping force to apply on @p body.
- * @param angular_damping The angular damping force to apply on @p body.
+ * @param linear_damping The linear damping factor to apply on @p body.
+ * @param angular_damping The angular damping factor to apply on @p body.
+ *
+ * @see ephysics_body_damping_get().
  *
  * @ingroup EPhysics_Body
  */
@@ -1325,6 +1327,23 @@ EAPI void ephysics_body_damping_set(EPhysics_Body *body, double linear_damping,
 
 /**
  * @brief
+ * Get the angular and linear damping values.
+ *
+ * Damping(linear and angular) values are applied to body's linear and angular
+ * velocity.
+ *
+ * @param body The physics body.
+ * @param linear_damping The linear damping factor applied over @p body.
+ * @param angular_damping The angular damping factor applied over @p body.
+ *
+ * @see ephysics_body_damping_set() for details.
+ *
+ * @ingroup EPhysics_Body
+ */
+EAPI void ephysics_body_damping_get(EPhysics_Body *body, double *linear_damping, double *angular_damping);
+
+/**
+ * @brief
  * Update the evas object associated to the body.
  *
  * This function should be called to update position and rotation of
index 6ad5dd8..a79a9cd 100644 (file)
@@ -660,6 +660,20 @@ ephysics_body_damping_set(EPhysics_Body *body, double linear_damping, double ang
 }
 
 EAPI void
+ephysics_body_damping_get(EPhysics_Body *body, double *linear_damping, double *angular_damping)
+{
+    if (!body)
+     {
+        ERR("Can't get damping, body is null.");
+        return;
+     }
+
+    if (linear_damping) *linear_damping = body->rigid_body->getLinearDamping();
+    if (angular_damping) *angular_damping =
+      body->rigid_body->getAngularDamping();
+}
+
+EAPI void
 ephysics_body_evas_object_update(EPhysics_Body *body)
 {
    if (!body)