[ODE] Time/Speed problem.
Jon Watte (ODE)
hplus-ode at mindcontrol.org
Fri Nov 10 11:01:55 MST 2006
Nick Carlson wrote:
> Is there anyway to adjust the simulation so that ODE focuses on
> crunching numbers, rather than worrying about real-time output?
> I tried manually adjusting deltaTime in the following function:
> dWorldStepFast1(theDynamicsWorldID, deltaTime, STEP_ITERATIONS);
> But the when I do this, the physics become noticeably unstable. (Body
> parts previously jointed together wildly flying apart, etc).
ODE solves the system each time you call dWorldStep() or
dWorldQuickStep() (the StepFast function is deprecated). If you want a
simulation result sooner, just call dWorldQuickStep() more often. The
reason it's in real time is probably your tie to OpenGL, which may in
turn tie into the vsync.
I would suggest calling collision/step in a tight loop for, say, 50
times, then render one frame of graphics; repeat. You can tune the value
"50" up or down depending on how interactive you wantit to be (chances
are, you could turn it to 500 and still be OK).
Also; deltaTime should be a fixed interval each step. Decide on an
update rate (say, 50 Hz, or 100 Hz), and put the inverse of that into
deltaTime for each call to step (thus, 0.02f for 50 Hz).
More information about the ODE