Some time ago I started a topic here because I had a problem with the basic movement of the fps camera. F.e. when I play the game on two different computers, on the first one I will jump 1meter, and on the other one 5.
I needed to use frame rate independent movement, so I did. But still my jump height isn't the same on every computer.
I have this outside the loop:
Code: Select all
u32 then = device->getTimer()->getTime();
// This is the movemen speed in units per second.
const f32 MOVEMENT_SPEED = 50.0f; // how fast camera moves
const f32 ROTATION_SPEED = 50.0f; // how fast camera rotates
Code: Select all
const u32 now = device->getTimer()->getTime();
const f32 frameDeltaTime = (f32)(now - then) / 1000.f; // Time in seconds
then = now;
world->stepSimulation(frameDeltaTime, 120);
world->debugDrawWorld(true);
world->debugDrawProperties(true);
if ( receiver.keyDown(KEY_SPACE))
{
camPos.Y += MOVEMENT_SPEED * frameDeltaTime;
camera->setPosition(camPos);
}
thanks in advance,
Diho