Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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

I have been looking everywhere trying to find out how to convert an angle in radians (expressed as -Pi to Pi) to a heading vector.

The only [x,y] answer I have found is, [cos(angle), sin(angle)] , however, this doesn't work! Or am I missing something?

I just want a vector pointing at a direction of a specified angle, and for it to have a magnitude of 1, such is called a "heading vector" I believe. At least it is in the various game code I look at.

CLARIFICATION: A heading vector is a vector with a magnitude of 1 with the start at 0, and the end (the arrowhead) at some value within a unit circle. A heading vector is a way of showing direction as a vector. I want to take an angle and express it as a vector, however, people seem to just be telling me how to do unit conversions.

I appreciate you trying to be helpful, however, hopefully these clarifications will guide others to giving more fitting responses.


share|cite|improve this question
An angle in standard position has one side on the positive x-axis, and is measured counter-clockwise. The angle for heading/bearing is measured from the positive y-axis, clockwise. – The Chaz 2.0 Aug 9 '12 at 23:56
This does not answer my question. – José Aug 10 '12 at 2:04
"...this doesn't work!" - you haven't said why... – J. M. Aug 10 '12 at 2:10
Let's stop using the word "heading". See the picture in the top right for visuals of "initial" and "terminal" sides of an angle. If you want a point that is one unit away from the origin that makes an angle $\theta$ with the positive x-axis when connected to the origin, that point is (cos $\theta$, sin $\theta$). If you want a vector, use brackets instead of parenthesis. – The Chaz 2.0 Aug 10 '12 at 2:18
J.M. - It doesn't work, because I have tried it and it gives strange answers!Funny I can't find a solution to a seemingly simple problem... – José Aug 10 '12 at 13:25

Your information is correct.

If you have an angle (A), in radians, in the range -Pi to Pi, then convert it to a vector (V) with:-

V.x = cos(A)

V.y = sin(A)

(The inverse is A = atan2 ( V.y, V.x ) )

If it doesn't work in your games code you should be looking for a typing error, or other silly little bug. Its not the maths.

share|cite|improve this answer

To convert radians to degrees, you multiply by $\frac {180}{\pi}$. The standard positions for angles and headings are different, as The Chaz has commented. To go from a regular angle of $\theta$ to a heading, the heading is $\frac {\pi}2 - \theta$ in radians or $90^\circ -\theta$ in degrees.

share|cite|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.