Public Group

# calculate the angle to face towards a point (2D)

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

## Recommended Posts

How would I calculate the angle one object would have to be at to face annother object, in 2D. everything I've searched suggested that the this would do it.... atan2( y2-y1, x2-x1); but it just keep returning values ranging from -1.3 to 0.01... and so forth wich do seem to be usefull. I thought maybe they were in radians so I converted to degrees but it didn't make any notice difference to put it in the range of 0-360 or even -180 - 180; any help on this would be most appreciated.

##### Share on other sites
First things first:
1) What language? C++?
3) Post the surrounding code (in [source] code here [/source] tags, please)

How do you know it isn't right? Have you validated the values by hand, or are you using them to draw something that doesn't look right?

##### Share on other sites
Original post by jouley
First things first:
1) What language? C++?
3) Post the surrounding code (in
 code here

How do you know it isn't right? Have you validated the values by hand, or are you using them to draw something that doesn't look right?[/quote]

figured it out, I was converting radians to radians making things really really small.

1. 1
2. 2
3. 3
Rutin
22
4. 4
frob
16
5. 5

• 9
• 33
• 13
• 12
• 10
• ### Forum Statistics

• Total Topics
632579
• Total Posts
3007178

×