if(isIdle_animation_current)return; //If we are already on idle animation just return so we can keep looping idle
isRunning_animation_current=false;
isIdle_animation_current=true;
DWORD dwNewTrack = ( m_dwCurrentTrack == 0 ? 1 : 0 );
LPD3DXANIMATIONSET pAS;
mAnimCtrl->GetAnimationSet( m_dwAnimIdxIdle, &pAS );
mAnimCtrl->SetTrackAnimationSet( dwNewTrack, pAS );
ReleaseCOM(pAS);
mAnimCtrl->UnkeyAllTrackEvents( m_dwCurrentTrack );
mAnimCtrl->UnkeyAllTrackEvents( dwNewTrack );
mAnimCtrl->KeyTrackEnable( m_dwCurrentTrack, FALSE, m_dTimeCurrent + MOVE_TRANSITION_TIME );
mAnimCtrl->KeyTrackSpeed( m_dwCurrentTrack, 0.0f, m_dTimeCurrent, MOVE_TRANSITION_TIME, D3DXTRANSITION_LINEAR );
mAnimCtrl->KeyTrackWeight( m_dwCurrentTrack, 0.0f, m_dTimeCurrent, MOVE_TRANSITION_TIME, D3DXTRANSITION_LINEAR );
mAnimCtrl->SetTrackEnable( dwNewTrack, TRUE );
mAnimCtrl->KeyTrackSpeed( dwNewTrack, 1.0f, m_dTimeCurrent, MOVE_TRANSITION_TIME, D3DXTRANSITION_LINEAR );
mAnimCtrl->KeyTrackWeight( dwNewTrack, 1.0f, m_dTimeCurrent, MOVE_TRANSITION_TIME, D3DXTRANSITION_LINEAR );
m_dwCurrentTrack = dwNewTrack;
GetMaxNumTracks and Oneshoot animation
Hi all,
I have an X skinned mesh with 3 animation. 1 is Idle,2 is running, 3 is casting
Idle and running is loopable animation and i blend this to swith from one to another accorgind to user input with somethings like this:
Now i want when user press a key to one-shoot cast animation but GetMaxNumTracks return 2 so i cannot add one more animation track number.
Cast is istant cast so at worst case i need to blend for example finish moving,start idle and cast. But i can't use 3 track.
Which is the right way to handle this? I mean i need to 1 shoot animation independently from running/idle. I already looked into directx sampler but sampler handle only 2 animation with DWORD dwNewTrack = ( m_dwCurrentTrack == 0 ? 1 : 0 );
Thx for your time.
ok maybe the question is too general. I will make a more specific one. When u have 4-5 animation sets you still use only track 0 and track 1 on animation controller ? How do you handle this? In my example,according to sdk example, run can be 0 or 1 also idle can be 0 or 1 and everthing work fine. But non looping animation like cast need to be a little different cause we need to check if it's finished.
Consider this situation:
I'm playing running animation in track 0.
Now i press cast and start playing cast animation in track 1.
During the cast i stop moving so i need to blend idle and running, off run and start idle.
I need one more track for sure. But GetMaxNumTracks==2.
So ?!
Thx.
Consider this situation:
I'm playing running animation in track 0.
Now i press cast and start playing cast animation in track 1.
During the cast i stop moving so i need to blend idle and running, off run and start idle.
I need one more track for sure. But GetMaxNumTracks==2.
So ?!
Thx.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement