[ODE] Damping

james at 6msoft.com james at 6msoft.com
Thu Jul 29 09:53:18 MST 2004


Ok, I added linear and angular damping per body in ODE. I did it
differently than Jon suggested and instead scaled velocities over time.
This will be available to the community with the PSCL release (which also
has Trimesh-plane collision).

In the end, 4 functions were added:

void dBodySetLinearDamping(dBodyID b, dReal d);
void dBodySetAngularDamping(dBodyID b, dReal d);
dReal dBodyGetLinearDamping(dBodyID b);
dReal dBodyGetAngularDamping(dBodyID b);

Does anyone think having global damping values might be worthwhile? ie,
take the larger of the two damping values when applying damping to a body.

-James

> Here's something Jon posted a little while back.  If you do a Google
> search with site:q12.org you can find answers to common questions like
> this.
>
> 1) Add damping. For each object, for each step, add counter-
>    force scaled by linear velocity, and counter-torque scaled
>    by angular velocity. From memory, it looks something like:
>
>    /*  Apply damping to the body to get it to settle properly     */
>    /*  over time. This also simulates "air drag" or "rolling      */
>    /*  friction" to some extent.                                  */
>    /*  Change "-0.01f" to some other negative number for tuning.  */
>    dVector3 v;
>    dBodyGetLinearVelocity( body, v );
>    v[0] *= -0.01f;   v[1] *= -0.01f;   v[2] *= -0.01f;
>    dBodyAddForcce( body, v );
>    dBodyGetAngularVelocity( body, v );
>    v[0] *= -0.01f;   v[1] *= -0.01f;   v[2] *= -0.01f;
>    dBodyAddTorque( body, v );



More information about the ODE mailing list