Rotation based on FPS

This topic is 4256 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hi there - can you guys tell me - how can i make the rotation baseon on fps - i need to rotate a dice - and on diferent fps the speed isnt the same. So at 400FPS i need like angle = 1; and at 30fps i need like angle = 8; this is the code that i use to rotate the dice on Z axis MatrixObj.Clear(); Quaternion.Rotatef(m_Angle,0,0,1); Quaternion.CreateMatrix(MatrixObj.matrix);

Share on other sites
What you should to is send a delta time to all your modules,
and according to that value calculate movement, rotation etc.

(The delta time is the time since the last frame.)
// angelStep is the degrees to rotate per secondfloat dt = getTimeSinceLastFrame(); // In secondsobj.rotate(angelStep * dt);

Share on other sites
So something like this:

currentTime
dTime = curentTime - LastTime
Update(dTime)
Render(dTime)
LastTime

angle = 2.0f * dTime - or?

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 13
• 26
• 10
• 11
• 9
• Forum Statistics

• Total Topics
633736
• Total Posts
3013601
×