Sign in to follow this  
Vanderry

[DX9] Get track progress of skinned mesh?

Recommended Posts

Hi folks ! This probably (hopefully) isn't too complicated but I wanted to make sure I get it right. Is there any way, given a linearly advancing time variable, that I could check how far along an animation track a skinned mesh is in the animation? I know that I can get the complete animation period as a double using ID3DXAnimationSet::GetPeriod() (measured in seconds?), but as I update the mesh I would like to check if the animation has exceeded its period so that I can change from let's say a finished "spell-casting" animation into "idle", rather than having it loop on forever. Thanks very much for any help on this !

Share this post


Link to post
Share on other sites

LPD3DXANIMATIONSET pASTrack = NULL;
pAC->GetTrackAnimationSet( m_dwCurrentTrack, &pASTrack );
if( pASTrack )
{
D3DXTRACK_DESC td;
pAC->GetTrackDesc( m_dwCurrentTrack, &td );
if( td.Position > pASTrack->GetPeriod() - EPSILON)
{
// Animation is within EPSILON of its 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