Archived

This topic is now archived and is closed to further replies.

Geronimo2000

ID3DXAnimationController::ResetTime() Confusion

Recommended Posts

Hey guys, I am having a world of trouble figuring out how ID3DXAnimationController::ResetTime() (and the rest of the interface for that matter) behaves. This is my confusion: It is my understanding that ID3DXAnimationController::AdvanceTime() updates from the previous animation time that has been accumulated. If I''m wrong - please tell me!!! So, it seems to me if I want to reset an animation set to time 0 (so the animation restarts), I need to call ResetTime(). My motivation for understanding this is I want to explicitly state the time to use for animation at each frame instead of passing in an increment/delta/offset value. OK, so I want to do this: m_animationControllerP->ResetTime() m_animationControllerP->AdvanceTime(totalAnimationTime, NULL) If that was all too murky, here is an explicit problem. I write the following: m_animationControllerP->ResetTime(); m_animationControllerP->ResetTime(); // shown for emphasis m_animationControllerP->AdvanceTime(.0067f, NULL); m_animationControllerP->ResetTime(); // " m_animationControllerP->ResetTime(); // " AND THE ANIMATION PLAYS PERFECTLY!!! I would have thought the animation would be eternally stuck at the frame where .0067f resolves to. I am obviously out of the loop here and have no idea how the interface works. I have looked at the new summer update DX9 documentation for the interface, and their MultiAnimation sample code as well but cannot see what I''m doing wrong. Also, the tutorial in the documentation infers that when cloning, a new set of matrices can be generated so that AdvanceTime need NOT be called RIGHT BEFORE rendering each instance that uses a cloned controller (this was in the ''Pitfalls'' section). This is obviously not the default, and there''s no interface for getting any matrices right? I''d like someone to confirm that the suggestion in the documentation is not feasible in DX9.

Share this post


Link to post
Share on other sites
The animation is not only controlled by the global time of the animation controller, but the position of each track as well. Look into ID3DXAnimationController::SetTrackPosition(). If you call it with 0 before you call AdvanceTime(), your animation will appear stopped.

By default, when you clone an animation controller, the new AC uses the same matrix hierarchy as the old one. To have the new AC use a different set of matrices, call ID3DXAnimationController::RegisterAnimationOutput() with the new matrices for each frame in the hierarchy. You can set pScale, pRotation, and pTranslation to NULL if you are not interested in these elements. pMatrix is the matrix to receive the final transformation, or pScale * pRotation * pTranslation.

Share this post


Link to post
Share on other sites