Jump to content
  • Advertisement
Sign in to follow this  
Gullanian

Calculating angle from two co-ordinates

This topic is 4290 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
First off, an angle is something you have between two directions, not between two points.

However, I assume that you want the angle between the direction of the x-axis and the direction between the points. This is easy, if you program in c/c++ or similiar there is a function called atan2() which takes the difference in y as its first parameter and the difference in x as its second. It returns the angle in radians (between -pi and pi) (1 radian=180/pi degrees).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!