Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. 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

I have an object and an angle value (clockwise) in my game.

Depending on the angle, the object will move toward a certain direction.

If the angle is 0, the object will move (0,1) per frame (x,y) where positive y is "up". If the angle is 90, the object will move (1,0). If the angle is 45, the object will move (1,1). Decimal values are possible for accuracy (all values will range from 0.0 to 1.0).

But, what steps am I supposed to take to calculate such values. Any ideas?

share|cite|improve this question
up vote 2 down vote accepted

If the angle is $\omega$ from the y-axis (clockwise) then you should take steps exactly $(\sin(\omega), \cos(\omega))$, i.e. $\sin(\omega)$ in the x-direction and $\cos(\omega)$ in the y-direction. For example, for $\omega = 45^o$ this gives exactly $(\frac{1}{2} \sqrt{2},\frac{1}{2} \sqrt{2})$ (which is $(1,1)$, normalized at length $1$) while for $\omega = 90^o$ we get $(1,0)$.

share|cite|improve this answer

I would use the Unit Circle and keep putting the origin as your last point, i.e. if you move up 90, now your origin of the circle is $(1, 0)$ and use the circle again. Also, to keep things symmetric, the angle 45 should go to $(\sqrt{2}/2, \sqrt{2}/2)$, not $(1, 1)$.

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.