Sign in to follow this  
JeremyCAFE

Getting Current Animation Position

Recommended Posts

I am having trouble finding the current position (percent wise) in an animation set. Using the following function does not seem to return what I think it does. It never returns anything less than .10f. // Outside of function animeCon->GetAnimationSet(m_dwPrevIndex, &animation); animeCon->SetTrackAnimationSet(m_dwCurrentTrack, animation); animeCon->GetTrackDesc( m_dwCurrentTrack, & td ); double SkinnedMesh::GetAnimationPercent(void) { return animation->GetPeriodicPosition(td.Position) / animation->GetPeriod(); } I am trying to know when I reach a point in an animation set that is 80% complete so I can set the next animation to blend into. Can I get some advise on how to figure this out? thanks.

Share this post


Link to post
Share on other sites
The following code should give the right result:

// Get animation set in pAnimSet
m_pAnimationController->GetAnimationSet(i, &pAnimSet)

// Get information of current track
D3DXTRACK_DESC Track;
m_pAnimationController->GetTrackDesc(m_iCurrentTrack, &Track);

// Return current position in 0..1 range
return (Track.Position / pAnimSet->GetPeriod());

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