Lets say I have a model with multiple meshes. Mesh A is at position
PositionA = new Vector3(5,0,10). And mesh B is at position
PositionB = new Vector3(7,0,9). How can I rotate mesh B around meshes A pivot point, or its centre?
In Xna, you can orbit
positionA like this:
Matrix orbit = Matrix.CreateFromAxisAngle(someAxis, someAngle); positionB = Vector3.Transform(positionB - positionA, orbit) + positionA; MeshBworld.translation = positionB;
someAxis is a unit length vector representing the direction of the pivot axis and
someAnglerepresents the amount of single frame orbiting rotation in radians.
MeshBworld is simply Mesh B's world transform... whatever you've named it.