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

  • 2
    \$\begingroup\$ As a side note ... why? Most calculations for a game, including rotations by the same angle, you can do without touching trigonometric functions. \$\endgroup\$ – 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)

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

angle = tan_inverse(VelocityY/VelocityX)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.