# Calculating the angular direction from velocity

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

• 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

read the following page you have to use atan2 : http://www.w3schools.com/jsref/jsref_atan.asp

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

• Nothing wrong with the W3Schools page, but just to let you know: W3Fools.com – Some Guy Nov 23 '11 at 9:39

angle = tan_inverse(VelocityY/VelocityX)