How to perform 'root node integration'?

Topics: Developer Forum
Feb 17, 2007 at 4:12 PM
Edited Feb 17, 2007 at 4:13 PM
In the tutorial, the character translates and rotates by having the code manually adjust the transform of the character when he is walking. However, what if I wanted to perform root node integration to move the character based on the animation of a particular bone in the model?

In my animations, the character's root node translates (and rotates), so that, on a walk cycle for example, I should be integrating the transformation of the root node into the model's world translation, and that would cause the character to very naturally move, without foot slippage, etc.

How would you propose I accomplish this?

Right now, for trying to get the walk cycle working, I am experimenting with setting looping on the animation to false, and then handling the event that is raised at the end of the animation. Then I need to calculate the delta in transform for the root node over the animation that just occurred, and make a change to the World transformation stored in the ModelAnimator.

This seems like something that perhaps the ModelAnimator could be doing for me? Or is there some better way to do this that you'd suggest?
Feb 17, 2007 at 4:38 PM
An added complication -- I thought what I would want to do is something like:

Matrix defaultTransform = mawgAnimator.BonePoses"root".DefaultTransform;
Matrix currentTransform = mawgAnimator.BonePoses"root".CurrentTransform;

... and work out the delta between those two. But I don't want the default translation - I want the transform at the start of the animation, and the transform at the end of the animation.
Feb 17, 2007 at 7:00 PM
Edited Feb 17, 2007 at 7:13 PM
So, if I understand you correctly, the dwarf moves in the animation even if the World transform stays still?

I.E., you want to sync the world movement with the movement in the animation?

By the way, you can get the transform at the start and end of the animation by:

   AnimationInfo animInfo = myAnimationController.AnimationSource;
   Matrix start = animInfo.AnimationChannels["root"][0].Transform;
   Matrix end   = animInfo.AnimationChannels["root"][
       animInfo.AnimationChannels["root"].Count - 1].Transform;
Feb 17, 2007 at 7:51 PM
That is correct, there is a node called "root" which translates and rotates during a walk cycle, and I want to preserve that transformation after the animation. I assumed the "right" way to do this was to multiply the transformation into the World transform after the animation is completed. I got this working - I will clean up the code and post what I did here.

Your suggestion is very helpful - I worked around not knowing that before by storing the Transform before I started the animation. :)
Feb 17, 2007 at 7:56 PM
Yah, that is a good way to do it. This thread reminded me to add an AnimationSource"boneName".GetTransformByTime method.
Aug 24, 2007 at 12:50 AM
robburke, do you have that code on how to "multiply the transformation into the World tranform"? I've been trying to do it for my project and can't seem to make it work.

I have an animated fbx of a book opening that rotates as the book opens.but I seem to loose the parent bone's ("spine") rotation when I use the DefaultTransform. I was hoping that root node integration might be the solution. Any suggestions?

Some details: the animation starts with the book on it's side, then as it opens it should rotate the parent (spine) as well so the book lays open. but it doesn't.