Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 2 down vote accepted

In Xna, you can orbit positionB around positionA like this:

Matrix orbit = Matrix.CreateFromAxisAngle(someAxis, someAngle);
positionB = Vector3.Transform(positionB - positionA, orbit) + positionA;
MeshBworld.translation = positionB;

where 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.

share|improve this answer
Wooho it works! Thanks! – user1806687 Nov 23 '12 at 17:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.