I'm programming a basic game on XNA. I started to place an object (eg weapon) attached to the right arm of my player. When I move my character forward behind left or right all right. But when I rotates my equipment is not positioned correctly. I am fully understands it is necessary to recalculate the new position based on the rotation done but I do not see how. Here is my code and pictures
//Function that will draw the current item selection in the player's hand
private void draw_itemActionInUse(Model modelInUse)
{
int handIndex = skinningData.BoneIndices["Hand_Right"];
Matrix[] worldTransforms = animationPlayer.GetWorldTransforms();
Matrix rotationMatrixCalcul = Matrix.CreateRotationY(player.Rotation.Y);
//Here I calculate the new position of the item, but it does not work
Vector3 newPosition= Vector3.Transform(new Vector3(player.Position.X, player.Position.Y + 4, player.Position.Z ), rotationMatrixCalcul);
foreach (ModelMesh mesh in modelInUse.Meshes)
{
foreach (BasicEffect effect in mesh.Effects)
{
effect.World =
worldTransforms[handIndex]
*
Matrix.CreateScale(2)
*
Matrix.CreateRotationY(player.Rotation.Y)
*
Matrix.CreateTranslation(newPosition);
effect.View = View_;
effect.Projection = Projection_;
effect.EnableDefaultLighting();
}
mesh.Draw();
}
}

Figure A:
position: x:0;y:0;z:0
angle : 90
Figure B:
position: x:2;y:4;z:0
angle : 90
Figure A:
position: x:1;y:0;z:1
angle : 35
Figure B:
position: How calcul this position ?
angle : 35
