[ODE] Damping
Jon Watte
hplus-ode at mindcontrol.org
Fri Jul 30 00:42:20 MST 2004
Why did you implement it differently?
I have been extremely happy with the behavior of the
force/torque based dampening, and it's what my apps
have been (and will keep on) doing. Behaviorally, it's
well tested. If you have this particular piece of code,
then I'll have to set it to 0, and do my own dampening
anyway, and more useless work will be done by the
library.
But maybe you have a really good reason?
Also, what is the unit? Is it scaled by the time step,
or is that up to the user?
If you want to have global dampening values, those
should probably be dealt with the same way as the
global body auto-sleep values; if you set them globally,
then they are copied on creation, but changing them
after a body is created has no effect on created bodies.
That's the precedent, and it seems to work pretty well,
so being consistent is a good thing.
Another precedent is having a global enable. Something
like dWorldSetAutoDampening() to enable/disable the
behavior; possibly with a default of off.
Cheers,
/ h+
-----Original Message-----
From: ode-bounces at q12.org [mailto:ode-bounces at q12.org]On Behalf Of
james at 6msoft.com
Sent: Thursday, July 29, 2004 9:53 AM
To: ode at q12.org
Subject: [ODE] Damping
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 );
_______________________________________________
ODE mailing list
ODE at q12.org
http://q12.org/mailman/listinfo/ode
More information about the ODE
mailing list