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
This commit is contained in:
Bruno Dilly 2012-06-29 22:24:33 +00:00
parent 05988c9feb
commit ea31a552ef
2 changed files with 59 additions and 0 deletions

View File

@ -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);
/**
* @}
*/

View File

@ -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