ODE  0.13.1
 All Data Structures Functions Variables Typedefs Enumerations Groups

Functions

dReal dWorldGetLinearDampingThreshold (dWorldID w)
 Get the world's linear damping threshold.
 
void dWorldSetLinearDampingThreshold (dWorldID w, dReal threshold)
 Set the world's linear damping threshold. More...
 
dReal dWorldGetAngularDampingThreshold (dWorldID w)
 Get the world's angular damping threshold.
 
void dWorldSetAngularDampingThreshold (dWorldID w, dReal threshold)
 Set the world's angular damping threshold. More...
 
dReal dWorldGetLinearDamping (dWorldID w)
 Get the world's linear damping scale.
 
void dWorldSetLinearDamping (dWorldID w, dReal scale)
 Set the world's linear damping scale. More...
 
dReal dWorldGetAngularDamping (dWorldID w)
 Get the world's angular damping scale.
 
void dWorldSetAngularDamping (dWorldID w, dReal scale)
 Set the world's angular damping scale. More...
 
void dWorldSetDamping (dWorldID w, dReal linear_scale, dReal angular_scale)
 Convenience function to set body linear and angular scales. More...
 
dReal dWorldGetMaxAngularSpeed (dWorldID w)
 Get the default maximum angular speed. More...
 
void dWorldSetMaxAngularSpeed (dWorldID w, dReal max_speed)
 Set the default maximum angular speed for new bodies. More...
 
void dBodySetDampingDefaults (dBodyID b)
 Resets the damping settings to the current world's settings.
 
dReal dBodyGetLinearDamping (dBodyID b)
 Get the body's linear damping scale.
 
void dBodySetLinearDamping (dBodyID b, dReal scale)
 Set the body's linear damping scale. More...
 
dReal dBodyGetAngularDamping (dBodyID b)
 Get the body's angular damping scale. More...
 
void dBodySetAngularDamping (dBodyID b, dReal scale)
 Set the body's angular damping scale. More...
 
void dBodySetDamping (dBodyID b, dReal linear_scale, dReal angular_scale)
 Convenience function to set linear and angular scales at once. More...
 
dReal dBodyGetLinearDampingThreshold (dBodyID b)
 Get the body's linear damping threshold.
 
void dBodySetLinearDampingThreshold (dBodyID b, dReal threshold)
 Set the body's linear damping threshold. More...
 
dReal dBodyGetAngularDampingThreshold (dBodyID b)
 Get the body's angular damping threshold.
 
void dBodySetAngularDampingThreshold (dBodyID b, dReal threshold)
 Set the body's angular damping threshold. More...
 

Detailed Description

Damping serves two purposes: reduce simulation instability, and to allow the bodies to come to rest (and possibly auto-disabling them).

Bodies are constructed using the world's current damping parameters. Setting the scales to 0 disables the damping.

Here is how it is done: after every time step linear and angular velocities are tested against the corresponding thresholds. If they are above, they are multiplied by (1 - scale). So a negative scale value will actually increase the speed, and values greater than one will make the object oscillate every step; both can make the simulation unstable.

To disable damping just set the damping scale to zero.

You can also limit the maximum angular velocity. In contrast to the damping functions, the angular velocity is affected before the body is moved. This means that it will introduce errors in joints that are forcing the body to rotate too fast. Some bodies have naturally high angular velocities (like cars' wheels), so you may want to give them a very high (like the default, dInfinity) limit.

Note
The velocities are damped after the stepper function has moved the object. Otherwise the damping could introduce errors in joints. First the joint constraints are processed by the stepper (moving the body), then the damping is applied.
The damping happens right after the moved callback is called; this way it still possible use the exact velocities the body has acquired during the step. You can even use the callback to create your own customized damping.

Function Documentation

dReal dBodyGetAngularDamping ( dBodyID  b)

Get the body's angular damping scale.

Remarks
If the body's angular damping scale was not set, this function returns the world's angular damping scale.
void dBodySetAngularDamping ( dBodyID  b,
dReal  scale 
)

Set the body's angular damping scale.

Parameters
scaleThe angular damping scale. Should be in the interval [0, 1].
Remarks
From now on the body will not use the world's angular damping scale until dBodyResetAngularDamping() is called.
See Also
dBodyResetAngularDamping()
void dBodySetAngularDampingThreshold ( dBodyID  b,
dReal  threshold 
)

Set the body's angular damping threshold.

Parameters
thresholdThe angular threshold to be used. Damping is only used if the angular speed is above this limit.
void dBodySetDamping ( dBodyID  b,
dReal  linear_scale,
dReal  angular_scale 
)

Convenience function to set linear and angular scales at once.

Parameters
linear_scaleThe linear damping scale. Should be in the interval [0, 1].
angular_scaleThe angular damping scale. Should be in the interval [0, 1].
See Also
dBodySetLinearDamping() dBodySetAngularDamping()
void dBodySetLinearDamping ( dBodyID  b,
dReal  scale 
)

Set the body's linear damping scale.

Parameters
scaleThe linear damping scale. Should be in the interval [0, 1].
Remarks
From now on the body will not use the world's linear damping scale until dBodySetDampingDefaults() is called.
See Also
dBodySetDampingDefaults()
void dBodySetLinearDampingThreshold ( dBodyID  b,
dReal  threshold 
)

Set the body's linear damping threshold.

Parameters
thresholdThe linear threshold to be used. Damping is only applied if the linear speed is above this limit.
dReal dWorldGetMaxAngularSpeed ( dWorldID  w)

Get the default maximum angular speed.

See Also
dBodyGetMaxAngularSpeed()
void dWorldSetAngularDamping ( dWorldID  w,
dReal  scale 
)

Set the world's angular damping scale.

Parameters
scaleThe angular damping scale that is to be applied to bodies. Default is 0 (no damping). Should be in the interval [0, 1].
void dWorldSetAngularDampingThreshold ( dWorldID  w,
dReal  threshold 
)

Set the world's angular damping threshold.

Parameters
thresholdThe damping won't be applied if the angular speed is below this threshold. Default is 0.01.
void dWorldSetDamping ( dWorldID  w,
dReal  linear_scale,
dReal  angular_scale 
)

Convenience function to set body linear and angular scales.

Parameters
linear_scaleThe linear damping scale that is to be applied to bodies.
angular_scaleThe angular damping scale that is to be applied to bodies.
void dWorldSetLinearDamping ( dWorldID  w,
dReal  scale 
)

Set the world's linear damping scale.

Parameters
scaleThe linear damping scale that is to be applied to bodies. Default is 0 (no damping). Should be in the interval [0, 1].
void dWorldSetLinearDampingThreshold ( dWorldID  w,
dReal  threshold 
)

Set the world's linear damping threshold.

Parameters
thresholdThe damping won't be applied if the linear speed is below this threshold. Default is 0.01.
void dWorldSetMaxAngularSpeed ( dWorldID  w,
dReal  max_speed 
)

Set the default maximum angular speed for new bodies.

See Also
dBodySetMaxAngularSpeed()