How attach a model with another model on a specific bone?

I meet a difficulty attached to a model to another model on a "bone" accurate. I searched several forums but no result. I saw that many people have asked the same question but no real result see no response. Thread found :

How to attach two XNA models together?

How can I attach a model to the bone of another model?

https://stackoverflow.com/questions/11391852/attach-model-xna

But I think it is possible.

Here is my code example attached a "object" of the hand of my player

private void draw_itemActionAttached(Model modelInUse)
{
Matrix[] Model1TransfoMatrix = new Matrix[this.player.Model.Bones.Count];
this.player.Model.CopyAbsoluteBoneTransformsTo(Model1TransfoMatrix);
foreach (ModelMesh mesh in modelInUse.Meshes)
{
foreach (BasicEffect effect in mesh.Effects)
{
Matrix model2Transform = Matrix.CreateScale(1f) * Matrix.CreateFromYawPitchRoll(0, 0, 0);

effect.World = model2Transform * Model1TransfoMatrix[0]; //root bone index
}
mesh.Draw();
}
}

• try to switch multiplication order like this: effect.World = Model1TransfoMatrix[0]*model2Transform; – Vodáček Dec 18 '12 at 13:40
• it's the same result sory – Mehdi Bugnard Dec 26 '12 at 18:33
• Is it possible to retrieve the current position and rotation of a bone in my model? – Mehdi Bugnard Dec 26 '12 at 18:34
• I think yes, from matrix, why are you using root bone instaned of bone of the right hand? Do you have image with result that you have? – Vodáček Dec 27 '12 at 11:25

If you use this approach, you need to multiply the world matrix in the effect with the world matrix of the bone of model2:

private void draw_itemActionAttached(Model modelInUse)
{
Matrix[] Model1TransfoMatrix = new Matrix[this.player.Model.Bones.Count];
Matrix[] Model2TransfoMatrix = new Matrix[modelInUse.Bones.Count];
this.player.Model.CopyAbsoluteBoneTransformsTo(Model1TransfoMatrix);
modelInUse.CopyAbsoluteBoneTransformsTo(Model2TransfoMatrix);
foreach (ModelMesh mesh in modelInUse.Meshes)
{
foreach (BasicEffect effect in mesh.Effects)
{
Matrix model2Transform = Matrix.CreateScale(1f) * Matrix.CreateFromYawPitchRoll(0, 0, 0);

effect.World = Model1TransfoMatrix[0] * Model2TransfoMatrix[mesh.ParentBone.Index] * model2Transform;