[ODE] ODE behavior depends on frame rate. How to avoid this?
David McClurg
dmcclurg at pandemicstudios.com.au
Sun Feb 2 17:36:01 2003
what about replacing
dWorldStep (worldID, fTimeBetweenFrames);
with...
while (simTime < curTime)
{
dWorldStep (worldID, simTick);
simTime += simTick;
}
where curTime is the current time, simTime is the accumulated simulation time, and simTick is a small constant increment.
sometimes with this approach you'll need to monitor the number of sim ticks per frame and if they oscillate back and forth like 1,2,1,2,1,2 you need to ideally make your sim tick smaller (1/120.f) or (1/180.f) or add some smoothing so it goes 1,1,1,2,2,2,1,1,1,2,2,2
-----Original Message-----
From: Sergey [mailto:sergey_eu@cea.ru]
Sent: Sunday, 2 February 2003 5:33 AM
To: ode@q12.org
Subject: [ODE] ODE behavior depends on frame rate. How to avoid this?
Hello,
I am creating simple arcade racing game and recently have faced the
following problem: ODE behavior depends on frame rate because I use
dWorldStep (worldID, fTimeBetweenFrames)
I've read suggestion to divide physics and render cycles: use thread
for physics step and use main game cycle for rendering, but this won't
work in my case because I use modified Windows messaging cycle
(PeekMessage () instead of GetMessage ()) and unfortunately threads
does not work with PeekMessage () :(
How can I avoid dependency on frame rate? Any suggestions are welcome.
Sergei.