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

I'm trying to calculate the angular direction of a projectile, knowing it's X and Y velocity I can find the magnitude of its movement, but I'm having a hard time wrapping my mind around getting the angular direction (in radians) that it is moving...

I assume there is a tan or a sin involved, but I'm a bit clueless otherwise...

share|improve this question
As a side note ... why? Most calculations for a game, including rotations by the same angle, you can do without touching trigonometric functions. – Martin Sojka Sep 15 '11 at 18:14
up vote 9 down vote accepted

read the following page you have to use atan2 :

so angle = atan2 (vy,vx); and speed = sqrt(vy*vy + vx * vx)

share|improve this answer
Nothing wrong with the W3Schools page, but just to let you know: – Some Guy Nov 23 '11 at 9:39

angle = tan_inverse(VelocityY/VelocityX)

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.