Jump to content
  • Advertisement
Sign in to follow this  
repka3

GetMaxNumTracks and Oneshoot animation

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

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:
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;


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.

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
lol ok noone in the world has blended more then 2 animations.. Interesting.. hehe

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!