Rotating an object x revs per second.

Hi people,

This is a question based on the fact that I am a mathematical genius who has no time for trivial problems

I have a frame-rate (in seconds) m_FPS. I have a target of rotating my object m_RPM times every minute. I also know the current angle of the object m_Angle.

How can I combine these such that I can calculate m_Inc on each iterate of my object and have it rotate m_RPM times a minute?

I’m not going to use WM_TIMER messages to help with this because there is a slight danger they will get queued up somewhere when the system is loaded.

If you have the speed and timedelta, then just multiply them.

m_Inc = m_RPM * m_FPS / 60

You need to divide by 60 to conver M_RPM from per minute to per second.

Originally posted by Bob:
[b]If you have the speed and timedelta, then just multiply them.

m_Inc = m_RPM * m_FPS / 60

You need to divide by 60 to conver M_RPM from per minute to per second.[/b]

Erm, let me see - that has nothing to do with 360 degrees. So if RPM is 4 and my fps is 60, we have an increment of 4.

What I want to do is find Theta, where Theta is the angle I need to rotate the object by in order that the object rotates m_RPM times per minute ( or _RPM / 60 seconds of course).

I’m too tired today to get my head around this problem!

Thanks anyway.

I’ve been at work 30 seconds and cracked it - its too easy:

lastframetime * ( m_RPM / 60 ) * 360.

if ( g_Persist.m_bPaused )
{
return;
}

float TimeTakenInSeconds = m_Timer.GetTime ();
m_Timer.Reset ();
float RevolutionsPerSecond = ( m_RPM / 60.0f );
float AngleInc = ( 360.0f * TimeTakenInSeconds * RevolutionsPerSecond );
Orientation ( GetAngle () + AngleInc, VECTOR3D ( 1.0f, 0.0f, 0.0f ) );

As you said: you are a genius!