Hi all, I'm looking for a new approach to this animation math algorithm.
This approach is time line based and not relevant to the current frame. The reason for the change is that I need to be able to set FPS on the fly. If I do that in this case the frames will jump. I would expect a FPS change from 30 to 50 to jump, but this function will go nutz even if the frame rate is changed by one in some cases especially going down ( 30 to 29 ).
here is the code.
const s32 lenInMs = abs(s32( (EndFrame - StartFrame) / FramesPerSecond));
if (FramesPerSecond > 0.f) //forwards...
return StartFrame + ( (timeMs - BeginFrameTime) % lenInMs) * FramesPerSecond;
BeginFrameTime is set in the constructor
BeginFrameTime = os::Timer::getTime();
timeMs is the current Timer::getTime();
What I think I need here is a way to return currentFrame + one "vector" of movement. I have the currectFrame but I cant seem to get the math right. This way, when the FPS changes it just increase rather then jumping around. As I said its ok if the change to FPS is a great amount, that is understandable.
I had a few methods to this but I'm out of ideas, its just not working as I hoped, can any one take a stab at this?