Sign in to follow this  

Enable diffrent tracks in animation controller

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

ello, I want to switch between two animation tracks in the animation controller. But when I enable another track and disable track 0, nothing happens. The track is not played. Is it not possible to enable any other tracks than 0, and play them?

Share this post


Link to post
Share on other sites
Hello classmate! :-)

It is indeed possible to play many tracks at the same time, make sure you AdvanceTime() correctly with the frame timedelta and not the total time or something like that. Also make sure you try and do exactly like they do in the multianim samples, just to see if it works. Things like nothing happening can easily become the result if track weights are too high/low etc.

advance time should look something like this:

// delta_time = frame duration in seconds (float)
m_dTimeCurrent += delta_time;
pAC->AdvanceTime(delta_time, 0);



from the sdk's multianim sample:

void CTiny::SetMoveKey()
{
DWORD dwNewTrack = ( m_dwCurrentTrack == 0 ? 1 : 0 );
LPD3DXANIMATIONCONTROLLER pAC;
LPD3DXANIMATIONSET pAS;
m_pAI->GetAnimController( & pAC );

if( m_fSpeed == m_fSpeedWalk )
pAC->GetAnimationSet( m_dwAnimIdxWalk, & pAS );
else
pAC->GetAnimationSet( m_dwAnimIdxJog, & pAS );

pAC->SetTrackAnimationSet( dwNewTrack, pAS );
pAS->Release();

pAC->UnkeyAllTrackEvents( m_dwCurrentTrack );
pAC->UnkeyAllTrackEvents( dwNewTrack );

pAC->KeyTrackEnable( m_dwCurrentTrack, FALSE, m_dTimeCurrent + MOVE_TRANSITION_TIME );
pAC->KeyTrackSpeed( m_dwCurrentTrack, 0.0f, m_dTimeCurrent, MOVE_TRANSITION_TIME, D3DXTRANSITION_LINEAR );
pAC->KeyTrackWeight( m_dwCurrentTrack, 0.0f, m_dTimeCurrent, MOVE_TRANSITION_TIME, D3DXTRANSITION_LINEAR );
pAC->SetTrackEnable( dwNewTrack, TRUE );
pAC->KeyTrackSpeed( dwNewTrack, 1.0f, m_dTimeCurrent, MOVE_TRANSITION_TIME, D3DXTRANSITION_LINEAR );
pAC->KeyTrackWeight( dwNewTrack, 1.0f, m_dTimeCurrent, MOVE_TRANSITION_TIME, D3DXTRANSITION_LINEAR );

m_dwCurrentTrack = dwNewTrack;

pAC->Release();
}

Share this post


Link to post
Share on other sites

This topic is 4746 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.

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