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

enter image description here

I have a 3D Model like above in which i want to rotate it from a given location(pointed in red) but I can only rotate it from the middle. How can I rotate it from a custom point.


I successfully able to rotate the model from the below position by getting the radius of the model and applying it to the world matrix

        Vector3 point = new Vector3(-radius, 0, 0);
        world = Matrix.CreateTranslation(-radius, 0, 0);

But now I cannot change the position of the object and it always centered in middle of the screen. I think that's because i applied the above code. How can I place it anywhere I want?

share|improve this question
I think that it's similar to this:… – zacharmarz Nov 23 '11 at 11:04
up vote 2 down vote accepted

Finally i was able to do that,

    Matrix rotation = Matrix.Identity; 

Inside the constructor get the radius and make it minus. because originally it was set to Matrix.Identity

    rotation = Matrix.CreateTranslation(-radius, 0, 0);
share|improve this answer

You have to bring the point you want to rotate to the (0,0,0) position and then apply the rotation.

share|improve this answer
By point you mean the world coordinate? can u post some sample code – Nipuna Nov 23 '11 at 11:13
Yes, I mean translate the world coordinates of the point you wish to be your center of rotation to the origin ( 0,0,0 ). The sample code would be exactly what Dan answered. What you have to do (the concept is much more important than the code) is realize that the center of your object is in the (0,0,0) (that's why it rotates on it's own axis, because it is standing in the axis of rotation). Then to bring one corner of it to the origin you have to translate HALF of the object towards it. Ok my english is bad, I hope you understand what I'm trying to tell you. – mikidelux Nov 23 '11 at 11:26

You have to translate your custom point to the (0,0,0) and then rotate it from there. If your box is 2 x 5 x 2 and you wanted to rotate it over de the X axis, if were using OpenGL you could do something like this

glRotatef(rot, 1.0, 0.0, 0.0);
share|improve this answer

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.