Avatar postioning with World Matrix issues

February 9, 2010 by admin
Filed under: Xbox360 News 

Hey XNA Community,

I am not very good at this and have never really posted a question like
this on a forum so if I am a little wordy I am just trying to make sure I
get everything out.

I have written an Avatar wrapper for a
project I am working on. It is based both the Custom and Blended
Animation examples from this site. The Player Object that holds onto
the Avatar has its own World Matrix that it uses for both the Avatar and
the spaceship that represents the player in-game.

In the Draw I pass in the View and the Projection Matrices (I know now
that I do not need to send the Projection every time and will fix
that) and set the AvatarRenderer's View and Proj to them.

In the Player Update I pass in the corrected world Matrix to the Avatar
and set the AvatarRenderer's World with it. I also *= the ROOT transform
of the bones with the World, which orientates it correctly.

When World is set it is a property which sets my field AND the AvatarRenderer.World.

1 public void CAvatar.Update(GameTime _GameTime, Matrix _World) 
2
3   World = _World;  
5   UpdateTransforms(currtTopAnim.BoneTransforms, currBottomAnim.BoneTransforms); 
6

1 private void UpdateTransforms(ReadOnlyCollection<Matrix> _TopAnim, ReadOnlyCollection<Matrix> _BottomAnim) 
2 {           
3    // Copy the bottom transforms to the final list of transforms 
4    for (int i = 0; i < finalBoneTransforms.Count; i++) 
5    { 
6       finalBoneTransforms[i] = _BottomAnim[i]; 
7    } 
9    // Overwrite the transforms for the bones that are part of the top transform . 
10    if (currentBottomType != currentTopType) 
11    { 
12       for (int i = 0; i < bottomBones.Count; i++) 
13       { 
14          finalBoneTransforms[bottomBones[i]] = _TopAnim[bottomBones[i]]; 
15       } 
16    } 
18    finalBoneTransforms[(int)AvatarBone.Root] *= World; 
19

The Problem is the Avatar moves faster than the ship IDK why because it
just uses the same World as the ship.

I believe that is all that really effects the position of the Avatar but I am still doing something wrong. I don't believe it is the World itself due to the ship being rendered correctly. I must be missing something to do with the Avatar and its world but I don't have a lot of experience with XNA Avatar Code beyond the examples and working on this wrapper to combine both blended and custom animations.

Thanks for any help you can give me…

Comments

Feel free to leave a comment...
and oh, if you want a pic to show with your comment, go get a gravatar!