Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I multiply the mouse movement by a given number to get camera rotation of a desired speed. But it only works at 60 FPS. When I don't limit the frame rate I get around 350 FPS and the camera rotation is significantly too slow.

In my calculation, I already consider the frame time.

rotateCamera(ivec2 deltaMouse, float deltaTime, float sensitivity)
    // apply multipliers
    deltaMouse *= deltaTime;
    deltaMouse *= sensitivity;

    // rotate camera by deltaMouse
    // ...

Is this approach wrong? Why isn't the mouse movement independent from the frame rate in my code? How to achieve that?

share|improve this question
up vote 2 down vote accepted

Where's deltaMouse coming from? If the API you're using is giving you translation units like pixels or centimeters, you shouldn't scale by deltaTime. Moving your mouse 1 cm should rotate the camera by, say, 15 degrees, regardless of how many frames or how long it took to move that 1 cm.

share|improve this answer
I do not use a high level API. However, your answer is correct. The rotation shouldn't depend on the time at all. – danijar May 12 '13 at 11:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.