Jump to content
  • Advertisement
Sign in to follow this  
DarkZoulz

Enable diffrent tracks in animation controller

This topic is 4933 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
Advertisement
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
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!