# Xna GS 4 Animation Sample bone transforms not copying correctly

I have a person model that is animated and a suitcase model that is not. The person can pick up the suitcase and it should move to the location of the hand bone of the person model. Unfortunately the suitcase doesn't follow the animation correctly. it moves with the hand's animation but its position is under the ground and way too far to the right. I haven't scaled any of the models myself. Thank you. The source code (forgive the rough prototype code):

        Matrix[] tran = new Matrix[man.model.Bones.Count];// The absolute transforms from the animation player
man.model.CopyAbsoluteBoneTransformsTo(tran);

Vector3 suitcasePos, suitcaseScale, tempSuitcasePos = new Vector3();// Place holders for the Matrix Decompose
Quaternion suitcaseRot = new Quaternion();

// The transformation of the right hand bone is decomposed
tran[man.model.Bones["HPF_RightHand"].Index].Decompose(out suitcaseScale, out suitcaseRot, out tempSuitcasePos);

suitcasePos = new Vector3();
suitcasePos.X = tempSuitcasePos.Z;// The axes are inverted for some reason
suitcasePos.Y = -tempSuitcasePos.Y;
suitcasePos.Z = -tempSuitcasePos.X;

suitcase.Position = man.Position + suitcasePos;// The actual Suitcase properties
suitcase.Rotation = man.Rotation + new Vector3(suitcaseRot.X, suitcaseRot.Y, suitcaseRot.Z);


I am also copying the bone transforms from the animation player in the Person class like so:

        // The transformations from the AnimationPlayer
Matrix[] skinTrans = new Matrix[model.Bones.Count];
skinTrans = player.GetBoneTransforms();

// copy each transformation to its corresponding bone
for (int i = 0; i < skinTrans.Length; i++)
{
model.Bones[i].Transform = skinTrans[i];
}


EDIT:

Unfortunately I can't add screenshots, as this specific project has been lost to time. I still want to know why it didn't work, though.

• I still haven't been able to make this work... D: :'( Dec 23 '11 at 0:34