[ODE] Infinite sliding... ?
Jeff Kershner
jeff at jeffkershner.com
Wed Aug 16 13:50:11 MST 2006
This is what I did:
First: set mu to 10.0
Second: This is the third time I have heard that stepping at variable times
is very wrong. I can't find the FAQ about this except that it is wrong. In
a normal game loop that is operation almost all the time at 75 Hz, how much
should the step size be and how often should it be called every frame?
Third: can't do this since I need to interact with the bodies after they lay
at rest.
Forth: I saw in the FAQ/WIKI this question: "How do I stop things from
rolling into infinity..." This says to compute the velocity, multiply by a
damping coefficient like -0.01 and apply with dBodyAddForce.
This is what I do:
const dReal* v = dBodyGetLinearVel(it->body);
dBodyAddForce(it->body, v[0] * -0.01, v[1] * -0.01, v[2] * -0.01);
// Also so this for angular vel with a coefficient greater than 1
const dReal* av = dBodyGetLinearVel(it->body);
dBodyAddForce(it->body, av[0] * 2.0, av[1] * 2.0, av[2] * 2.0);
This is done at every frame when I update the graphical positions and
rotations.
After doing these steps, I am still getting boxes to slide forever.
Any suggestions?
-----Original Message-----
From: Jon Watte (ODE) [mailto:hplus-ode at mindcontrol.org]
Sent: Wednesday, August 16, 2006 12:42 PM
To: Jeff Kershner
Cc: ode at q12.org
Subject: Re: [ODE] Infinite sliding... ?
First, you should probably use a mu that's not infinity. Try 10.
Second, you need to make sure you use fixed time steps. All calls to
dWorldStep() (or the faster equivalents) need to pass in the same value
for delta-time -- no exceptions!
Third, you may want to enable auto-sleeping (disabling) of bodies at
rest, if it isn't already.
Fourth, you probably want to add dampening forces and torques to each
non-sleeping body for each step. There's an entry in the FAQ/Wiki about
this, IAICR. The most important part is actually the dampening torque,
in my experience.
Cheers,
/ h+
Jeff Kershner wrote:
>
> I have a room where I drop random boxes. The boxes seems to collide
> very accurately but don't ever stop moving.
>
> I am using surface mode dContactFDir1 | dContactApprox1 with mu =
> dInfinity. Everything else in that structure is zeroed out.
>
> The floor is a geom without a body so that it will never move like it
> says in the FAQ.
>
> Any suggestions?
>
> /jk
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
>
More information about the ODE
mailing list