From ea31a552ef15c6bddfe3b12127ff4dfba13639de Mon Sep 17 00:00:00 2001 From: Bruno Dilly Date: Fri, 29 Jun 2012 22:24:33 +0000 Subject: [PATCH] EPhysics: add linear slop setter / getter for world Constraint solver can be configured using some advanced settings, like the solver slop factor. Linear slop on sequencial impulse constraint solver is used as a factor for penetration. The penetration will the manifold distance + linear slop. SVN revision: 73066 --- legacy/ephysics/src/lib/EPhysics.h | 35 ++++++++++++++++++++++ legacy/ephysics/src/lib/ephysics_world.cpp | 24 +++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/legacy/ephysics/src/lib/EPhysics.h b/legacy/ephysics/src/lib/EPhysics.h index be887740f1..53878c2374 100644 --- a/legacy/ephysics/src/lib/EPhysics.h +++ b/legacy/ephysics/src/lib/EPhysics.h @@ -565,6 +565,41 @@ EAPI void ephysics_world_event_callback_add(EPhysics_World *world, EPhysics_Call */ EAPI void *ephysics_world_event_callback_del(EPhysics_World *world, EPhysics_Callback_Type type, EPhysics_World_Event_Cb func); +/** + * @brief + * Set linear slop to be used by world. + * + * Constraint solver can be configured using some advanced settings, like + * the solver slop factor. + * + * The default value is set to 0 with a small value results in a smoother + * stabilization for stacking bodies. + * + * Linear slop on sequencial impulse constraint solver is used as a factor + * for penetration. The penetration will the manifold distance + linear slop. + * + * @param world The physics world. + * @param linear_slop New linear slop value to be used by constraint solver + * of physics engine. + * + * @ingroup EPhysics_World + */ +EAPI void ephysics_world_linear_slop_set(EPhysics_World *world, double linear_slop); + +/** + * @brief + * Get linear slop used by world. + * + * @param world The physics world. + * @return Linear slop value used by constraint solver of physics engine or 0 + * on failure. + * + * @see ephysics_world_linear_slop_set() for details. + * + * @ingroup EPhysics_World + */ +EAPI double ephysics_world_linear_slop_get(EPhysics_World *world); + /** * @} */ diff --git a/legacy/ephysics/src/lib/ephysics_world.cpp b/legacy/ephysics/src/lib/ephysics_world.cpp index 0136a07e5d..7159eecbf3 100644 --- a/legacy/ephysics/src/lib/ephysics_world.cpp +++ b/legacy/ephysics/src/lib/ephysics_world.cpp @@ -642,6 +642,30 @@ ephysics_world_render_geometry_get(EPhysics_World *world, Evas_Coord *x, Evas_Co if (h) *h = world->h; } +EAPI void +ephysics_world_linear_slop_set(EPhysics_World *world, double linear_slop) +{ + if (!world) + { + ERR("Can't set linear slop, world is null."); + return; + } + + world->dynamics_world->getSolverInfo().m_linearSlop = btScalar(linear_slop); +} + +EAPI double +ephysics_world_linear_slop_get(EPhysics_World *world) +{ + if (!world) + { + ERR("Can't get linear slop, world is null."); + return 0; + } + + return world->dynamics_world->getSolverInfo().m_linearSlop; +} + #ifdef __cplusplus } #endif