[ODE] non static deltaTime in the step (worldStep(world,deltaTime) instead of worldStep(world,0.05)) => problem?

Nate W coding at natew.com
Fri Jan 11 11:55:02 2002


On Fri, 11 Jan 2002, [iso-8859-15] Frédéric Marmond wrote:

> deltaTime = timeNow - timeLast 
> then, i make a worldStep(world,deltaTime)
> Isn't it good?????

I'm doing something like this:

uThisTimerTick = GetTickCount ();
uMilliseconds = uThisTimerTick - m_uLastTimerTick;
m_uLastTimerTick = uThisTimerTick;

if (uMilliseconds > 100)
	uMilliseconds = 100;

if (uMilliseconds == 0) 
	uMilliseconds = 10;

real rElapsedTime = (real) uDeltaTime / 1000.0; 
dWorldStep (m_WorldID, rElapsedTime);

uDeltaTime to is clamped to 100 milliseconds, so that if the computer is
really bogged down, the simulation will slow down rather than trying to
run in real time with very large time steps.  Bumping uDeltaTime to 10
milliseconds prevents a division-by-zero error later on inside ODE.

This "window" function appears to be the main difference between your
code and mine, I hope it's helpful.

Also, setting the global CFM to 0 left my application prone to simulation
problems, but with a CFM of 0.001 it is much more stable.  Global ERP is
1.0, but I haven't experimented with that very much.

> I only detect collision when it touch the Z=0 plane (ground)
> After a bounce, it stabilize at this position (touch the plane Z=0)
> 
> But, after a while, it moves again, and make a great jump (unless its mass is 
> 800 and the gravitation is -9.81!!!)

I wonder if this is related to the "boiling" that has been described here
in a few other posts.  If the object/plane collision function only creates
one joint betweeen te box and surface, the object is free to rotate around
that joint, and thus it is likely to penetrate the plane.  It makes sense
that the simulation would respond by putting a lot of force onto the
object, which might cause the jump you're seeing.

-- 

Nate Waddoups
Redmond WA USA
http://www.natew.com