Jump to content
  • Advertisement
Sign in to follow this  

specifying specific keyframes in animation

This topic is 4107 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

I am using Brett Porter's code for loading, and animating a milkshape model. The problem is, the model contains different animations at specific keyframe intervals. For example, the model can "walk" ( keyframe 1 - 24 ), "run" ( keyframe 25 - 50 ) etc. Any good ideas on a draw method that I could use to specify a specific range of keyframes to animate? Right now I have it set up according to time. Is this the best way? Or should I specify the specific keyframe somehow? Here is what I have: void MilkshapeModel::draw(){ float time = glutGet(GLUT_ELAPSED_TIME) - m_pTimer; if( time > endTime - startTime ){ if(m_looping){ time = 0.0; restart(); } else time = endTime - startTime - 1; //m_totalTime - 1; } for(int i = 0; i < m_totalFrames - 1; i++){ if(frameTimes <= time + startTime && time + startTime < frameTimes[i+1]){ glCallList(framesList1 + i); return; } } if(frameTimes[m_totalFrames - 1] <= time && time <= m_totalTime){ glCallList(framesList1 + (m_totalFrames - 1)); } } void MilkshapeModel::setRange( float start, float end ) { startTime = start; endTime = end; }

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!