Direction formula?
I was wondering if anyone has any information on how to calculate the angle at which to rotate an object based on an x,y set of information?
Ie:
A circle has a point on it that I want to face the mouse. I have the x,y of the circle, and the x,y of the mouse. How can I figure the angle at which to rotate the circle?
Ie:
A circle has a point on it that I want to face the mouse. I have the x,y of the circle, and the x,y of the mouse. How can I figure the angle at which to rotate the circle?
Code:
atan2(mousey - circley, mousex - circlex)Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Thank you very much!
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Smooth acceleration in every direction. | Honey Sharma | 1 | 3,541 |
Aug 16, 2011 01:37 AM Last Post: PoseMotion |
|
| Formula for converting angle to vector? | komirad | 2 | 8,090 |
Jul 29, 2011 07:29 AM Last Post: ThemsAllTook |
|
| newbie request direction | Teehee | 3 | 5,445 |
Jul 27, 2011 09:57 AM Last Post: AndyKorth |
|
| give direction to sprite | termitis | 9 | 8,641 |
Mar 11, 2011 02:38 PM Last Post: compiler |
|
| Direction of normal | Miglu | 3 | 3,081 |
Oct 4, 2010 05:08 PM Last Post: Skorche |
|

