Jump to content
  • Advertisement
Sign in to follow this  
guvidu

Rotation based on FPS

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 second

float dt = getTimeSinceLastFrame(); // In seconds
obj.rotate(angelStep * dt);

Share this post


Link to post
Share on other sites
So something like this:

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

angle = 2.0f * dTime - or?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!