forked from enlightenment/efl
EPhysics: body damping set
This patch introduces a function for rigid body damping. Patch by: Leandro Dorileo <dorileo@profusion.mobi> SVN revision: 73382
This commit is contained in:
parent
c4d655f56b
commit
2afffbd809
|
@ -1245,6 +1245,37 @@ EAPI double ephysics_body_angular_velocity_get(const EPhysics_Body *body);
|
|||
*/
|
||||
EAPI void ephysics_body_stop(EPhysics_Body *body);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Set the angular and linear damping values.
|
||||
*
|
||||
* Damping(linear and angular) values are applied to body's linear and angular
|
||||
* velocity.
|
||||
*
|
||||
* By applying a bodies damping factor the user will face a velocity reduction,
|
||||
* with a force applied to it - like air resistance. The force is applied to
|
||||
* slow it down. Different factors can be applied to angular and linear
|
||||
* velocity to fine tune translation and rotation.
|
||||
*
|
||||
* The damping is a force synchronous with the velocity of the object but in
|
||||
* opposite direction.
|
||||
*
|
||||
* Damping is specified as a value between 0 and 1, which is the proportion of
|
||||
* velocity lost per second. If specified damping value - either for angular or
|
||||
* linear - is greater or equal to 1, velocities are nulled(that means, will
|
||||
* become 0 on every axis), resulting on a frozen body.
|
||||
*
|
||||
* Default linear damping is set to 0. The same is true for angular damping
|
||||
* 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.
|
||||
*
|
||||
* @ingroup EPhysics_Body
|
||||
*/
|
||||
EAPI void ephysics_body_damping_set(EPhysics_Body *body, double linear_damping, double angular_damping);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Update the evas object associated to the body.
|
||||
|
|
|
@ -646,6 +646,19 @@ ephysics_body_stop(EPhysics_Body *body)
|
|||
DBG("Body %p stopped", body);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ephysics_body_damping_set(EPhysics_Body *body, double linear_damping, double angular_damping)
|
||||
{
|
||||
if (!body)
|
||||
{
|
||||
ERR("Can't set body damping, body is null.");
|
||||
return;
|
||||
}
|
||||
|
||||
body->rigid_body->setDamping(btScalar(linear_damping),
|
||||
btScalar(angular_damping));
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ephysics_body_evas_object_update(EPhysics_Body *body)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue