Sign in to follow this  
scienceprodigy

specifying specific keyframes in animation

Recommended Posts

scienceprodigy    122
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[i] <= 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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this