Skip to main content
gamedev.net
🔒 Locked

ID3DXAnimationController problems

Started by peter_b Nov 22, 2004 at 2:32 AM 1 replies 500+ views
Original Post
peter_b
peter_b
Hello. I am having some trouble with the ID3DXAnimationController. I am trying to do a smooth transition from one animation track to another. But for some reason, it seems it only reacts to changes i do on track 0, when i try to start a new animation on track 1, nothing happens. If i start it on track 0, it works, but then it switches from the old one immediatly since it is already running on track 0 (i want it smooth). I dont get why it wont work on other tracks than 0.. Anyone seen it before? This is my code, it is exactly like the sdk samples does it, i cant find any diffrens in their approach and mine. Thanks in advance.

const float IDLE_TRANSITION_TIME = 1.125f;
			DWORD dwNewTrack = ( m_dwCurrentTrack == 0 ? 1 : 0 );
			LPD3DXANIMATIONSET anim_set;

			g_pAnimController->GetAnimationSet( 1, & anim_set );
			g_pAnimController->SetTrackAnimationSet( dwNewTrack, anim_set );

			anim_set->Release();

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

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

			m_dwCurrentTrack = dwNewTrack;


Shields up! Rrrrred alert!
DarthVeda
DarthVeda
You should call this function only once when you want to change the animation, make sure it is not being called on every frame.

It would be helpful if you give the Animate function code too.

peter_b
peter_b
it turned out i was calculating the time wrong, so problem solved. Thanks for the reply DarthVader
Shields up! Rrrrred alert!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.