{
Evas_Object *sphere1, *sphere2, *sh1, *sh2;
EPhysics_Body *sphere_body1, *sphere_body2;
+ double linear, angular;
sh1 = elm_layout_add(test_data->win);
elm_layout_file_set(
ephysics_body_linear_velocity_set(sphere_body2, -100, 0);
ephysics_body_damping_set(sphere_body2, 0.5, 0.5);
test_data->bodies = eina_list_append(test_data->bodies, sphere_body2);
+
+ ephysics_body_sleeping_threshold_get(sphere_body1, &linear, &angular);
+ INF("Body 1: linear threshold: %.2f, angular: %.2f", linear, angular);
+ ephysics_body_sleeping_threshold_get(sphere_body2, &linear, &angular);
+ INF("Body 2: linear threshold: %.2f, angular: %.2f", linear, angular);
}
static void
* @param linear_threshold The linear sleeping threshold factor.
* @param angular_threshold The angular sleeping threshold factor.
*
- * @see ephysics_body_linear_sleeping_threshold_get()
- * @see ephysics_body_angular_sleeping_threshold_get()
+ * @see ephysics_body_sleeping_threshold_get().
* @see ephysics_world_max_sleeping_time_set() for sleeping time details.
+ *
* @ingroup EPhysics_Body
*/
EAPI void ephysics_body_sleeping_threshold_set(EPhysics_Body *body, double linear_threshold, double angular_threshold);
* Get the linear sleeping threshold.
*
* @note The linear sleeping threshold is measured in Evas coordinates per
- * second.
+ * second and the angular sleeping threshold is measured in degrees..
*
* @param body The body to get the linear sleeping threshold from.
- * @return The linear sleeping threshold from @p body.
- *
- * @see ephysics_body_sleeping_threshold_set()
- * @ingroup EPhysics_Body
- */
-EAPI double ephysics_body_linear_sleeping_threshold_get(const EPhysics_Body *body);
-
-/**
- * @brief
- * Get the angular sleeping threshold.
- *
- * @note The angular sleeping threshold is measured in degrees.
+ * @param linear_threshold The linear sleeping threshold factor.
+ * @param angular_threshold The angular sleeping threshold factor.
*
- * @param body The body to get the angular sleeping threshold from.
- * @return The angular sleeping threshold from @p body.
+ * @see ephysics_body_sleeping_threshold_set() for more details.
*
- * @see ephysics_body_sleeping_threshold_set()
* @ingroup EPhysics_Body
*/
-EAPI double ephysics_body_angular_sleeping_threshold_get(const EPhysics_Body *body);
+EAPI void ephysics_body_sleeping_threshold_get(const EPhysics_Body *body, double *linear_threshold, double *angular_threshold);
/**
* @brief
angular_threshold / RAD_TO_DEG);
}
-EAPI double
-ephysics_body_linear_sleeping_threshold_get(const EPhysics_Body *body)
+EAPI void
+ephysics_body_sleeping_threshold_get(const EPhysics_Body *body, double *linear_threshold, double *angular_threshold)
{
double rate;
if (!body)
{
ERR("Can't get linear sleeping threshold, body is null.");
- return 0;
+ return;
}
rate = ephysics_world_rate_get(body->world);
- return body->rigid_body->getLinearSleepingThreshold() * rate;
-}
-
-EAPI double
-ephysics_body_angular_sleeping_threshold_get(const EPhysics_Body *body)
-{
- if (!body)
- {
- ERR("Can't get angular sleeping threshold, body is null.");
- return 0;
- }
-
- return body->rigid_body->getAngularSleepingThreshold() * RAD_TO_DEG;
+ if (linear_threshold)
+ *linear_threshold = body->rigid_body->getLinearSleepingThreshold() * rate;
+ if (angular_threshold)
+ *angular_threshold = body->rigid_body->getAngularSleepingThreshold() *
+ RAD_TO_DEG;
}
EAPI void