[ODE] Reducing jitter when using QuickStep?
Megan Fox
shalinor at circustent.us
Sat Jul 17 08:38:16 MST 2004
Not quite working for me - maybe I need to explain my problem better.
The jitter I have at least appears to be the fault of very slight collision
innacuries on a frame to frame basis, causing very slight (but constant)
jittering of stacks of boxes. You can see the effect in
http://shalinor.circustent.us/elium/builds/physdemo.zip <-- notice how the
big wall dances around, and if you knock a chunk of the wall down to size,
how even a stack of 2 or 3 blocks has a slight jitter to it.
For whatever reason, these innacuracies don't present themselves at all when
dealing with small-large box collisions (note that the boxes on the floor
have absolutely no trouble coming to rest and getting disabled).
This is what I'm trying to defeat, I'm just not sure how. I've got
auto-disabling code built in, and it works great, but you throw one of these
"vibrating" blocks into the mix and it never seems to reach a point at which
the block (or its neighbors) can remain disabled.
To be complete, here's my auto-disabling code as well:
if (curObj->refPhysBody->GetLinearVel().lensquared() <
PHYS_LINEAR_VEL_THRESHOLD &&
curObj->refPhysBody->GetAngularVel().lensquared() <
PHYS_ANGULAR_VEL_THRESHOLD)
{
curObj->disableTimeout++;
if (curObj->disableTimeout > PHYS_VEL_THRESHOLD_TIMEOUT)
{
curObj->refPhysBody->Disable();
curObj->disableTimeout = 0;
}
}
(this is using the Nebula 2 wrapper for ODE, thus the slight oddity)
where the relevant defs up there are as follows:
#define PHYSICS_STEPSIZE 0.016f
#define PHYS_LINEAR_VEL_THRESHOLD 0.01
#define PHYS_ANGULAR_VEL_THRESHOLD 0.01
#define PHYS_VEL_THRESHOLD_TIMEOUT 10
Gravity is at -9.8, QuickStep is using 5 iterations, the collision space is
a hash space, and the max 3 contact joints generated are always given
dInfinity / 2.0f friction and use dContactApprox1.
Is the problem somewhere in my autodisabling, perhaps? Is this just a
problem with quickstep and object piles? I'm fed up with Tokamak, and ODE
is thiiis *makes small motion with fingers* close to doing EVERYTHING I
could possibly want... if I could just get rid of this jitter.
-Megan Fox
> I call this for each body, with "scale" values in the range
> of 0.01f or so. This will get rid of a lot of jitter and
> sudden explosions, and as an extra bonus, will make rolling
> spheres eventually stop rolling ;-)
>
> It's important that you dampen both linear and angular
> velocities, btw.
>
> Cheers,
>
> / h+
More information about the ODE
mailing list