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

If I have a Vector, say (1,1), how can I rotate it around the origin (0,0)?

I'm working in XNA if that helps.

share|improve this question
Is this a question about the mathematics or the implementation? – aaaaaaaaaaaa Dec 15 '10 at 18:07
up vote 8 down vote accepted

Just multiply the vector by a rotation matrix:

| fx |     | cos a    -sin a | | sx |
| fy |  =  | sin a    -cos a | | sy |

where fx and fy are final coordinates of the object after the rotation and sx, sy are starting one. Obviously a is the angle involved.

share|improve this answer

Since you are using XNA, there is an easy way to do the above, which can be found in this following thread. In shows how to perform the transformation in 3D or 2D. For 2D, it is as simple as:

point = Vector2.Transform(point, Matrix.CreateRotationZ(AngleToRotate);
point += originPoint;

Note that AngleToRotate is in radians. If you want to use Degrees you can can take advantage of

MathHelper.ToRadians(float degree)

which is a static method.

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.