Retrieving bone transformations problem

Hi its me again.
I am on a stage when I try to put the weapon in the guy's hand. And I read the previous post about it, but I cant get it to work correctly.

Ive tried both
CopyAbsoluteBoneTransformsTo and CopyBoneTransformsTo.
This is how I am using it:

//Get bone matrix
model_.CopyAbsoluteBoneTransformsTo(matrices_);
if (boneName_ != null) boneWorld_ = matrices_[model_.Bones[boneName_].Index];

//Add shift to place weapon correctly into guy's hand
Matrix shift = Matrix.Identity * Matrix.CreateTranslation(new Vector3(0, 10, 10));
//Setup weapon position matrix
Matrix handMat = _player.boneWorld_ * Matrix.CreateTranslation(new Vector3(0, 1.5f, 10)) * player_.World;
//place weapon
uzi_.Position = handMat.Translation;
uzi_.Up = handMat.Up;
uzi_.Right = handMat.Right;
uzi_.Direction = handMat.Forward;

using CopyAbsoluteBoneTransformsTo function rotates the model with the player AND with his hand rotation, however it doesnt move the weapon with the hand. So if hand is doing some animation while player is standing, weapon will only rotate but not move.

using CopyBoneTransformsTo gives me something totally weird so even rotation is on different axis then the hand.

Help please! D:

Ah might be incorrect weapon

Ah might be incorrect weapon origin on my part... But now I am getting some "lag" between hand movement and weapon movement. Its like a weapon is on a "spring". I only have one animated model atm... and I retrieve model_.CopyAbsoluteBoneTransformsTo(matrices_) right before GeneratePose function (in ModelDraw). Is there something I am doing wrong?
Thanks

this is a short video of the prob
http://www.youtube.com/watch?v=VuvmNZKYBf0

jwatte's picture

If you have lag, it sounds

If you have lag, it sounds like you draw your pose and your weapon with animation data from different time steps.
Make sure you first update all animations, then retrieve all transforms, and finally render all objects.

Still cant get it working

Still cant get it working :(
I moved transform retrieval function (CopyAbsoluteBoneTransformsTo) for the guy's hand right before uzi is drawn, and after player is drawn.
Now it looks like springing cut by half but its still jumping in his hand.

jwatte's picture

When you use PIX for Windows,

When you use PIX for Windows, and compare the matrix used for the hand in the skinning pose, and the matrix used for the Uzi, are they the same?

heh havent ever used that

heh havent ever used that before. Ill take a look thanks

Ok my noob fault again. You

Ok my noob fault again. You were right I did not update the world matrix for uzi before it was sent to renderer.