[ODE] Damping

james at 6msoft.com james at 6msoft.com
Thu Jul 29 07:42:07 MST 2004


I was afraid I might have to do something like this (not like its a
terribly big deal though). Maybe I will just add it to ODE it self since I
already added a few things anyways.

-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