I started to use Irrlicht in combination with ODE some time ago.
Everything works fine so far, but i wonder if i should apply forces, torques and such in a framerate dependent way as you would move your Irrlichtnode in a "normal" way.
Say you have this code (using no physics)
Code: Select all
irr::ITimer* timer = device->getTimer();
irr::u32 then = timer->getTime();
irr::u32 now = 0;
irr::f32 elapsed = 0.0f;
...
//compute time since last frame
now = timer->getTime();
elapsed = (now - then) / 1000.f;
then = now;
...
void moveForward(const irr::f32 elapsed)
{
const irr::f32 dist = speed * elapsed;
//move in a framerate dependant way
}
Code: Select all
void moveForward(const irr::f32 elapsed) const
{
const irr::f32 dist = speed * elapsed;
dBodyAddTorque(odeBody, dist, 0, 0);
}
Code: Select all
dWorldStep(theWorld, 0.1f);I hope you understand my question.
regards
randomMesh
