Angle between two points?
I am trying like crazy to get the angle of Rotation between two points an just can't seem to figure it out
This is what I am trying to do
Object Position (First Points)
Object Position + Object Speed (Second Points)
Distance between = Rotation?
I have found a way to almost get the right angle but I need it to be FLAWLESS
opp= Object.y  Object.y + Speed;
adj = Object.x  Object.y + Speed;
Rotation Angle = atan(opp/adj) *180/PI;
This is what I am trying to do
Object Position (First Points)
Object Position + Object Speed (Second Points)
Distance between = Rotation?
I have found a way to almost get the right angle but I need it to be FLAWLESS
opp= Object.y  Object.y + Speed;
adj = Object.x  Object.y + Speed;
Rotation Angle = atan(opp/adj) *180/PI;
I'm confused, do you mean the angle between two points and the origin? You need three points for an angle.
I'm not certain I understand the question fully, but that being said, look into atan2()... it's significantly more useful than vanilla atan()
i just tried tan2 & it to failed.
What I am trying to do is have
Object point to Object + Speed
What I am trying to do is have
Object point to Object + Speed
Please provide more details. What inputs do you have, and what output are you trying to compute? What does "i just tried tan2 & it to failed" mean? What does "Object point to Object + Speed" mean? Your question is incomprehensible the way it was phrased.
If I launch a projectile what would the Angle be between the Objects present Position & the previous Position
I still think your confused. But I think you might be assuming its the angle in respect to the ground?
I suppose you could create a delta vector.
//create delta
delta_vec = position_new  position_old
//copy it
ground_ref = delta_vec
ground_ref.y = 0
Now you have two vectors. Normalize both of them. Take the dot product of both vetors. Now, cos( theta ) = dot( v1 , v2 ) . Just do inverse arc cos on the dot product and you should get theta in radians. To convert to degrees just multiply it by 180/pie . It will return a value betwen 0 and 180.
Hope that helps.
I suppose you could create a delta vector.
//create delta
delta_vec = position_new  position_old
//copy it
ground_ref = delta_vec
ground_ref.y = 0
Now you have two vectors. Normalize both of them. Take the dot product of both vetors. Now, cos( theta ) = dot( v1 , v2 ) . Just do inverse arc cos on the dot product and you should get theta in radians. To convert to degrees just multiply it by 180/pie . It will return a value betwen 0 and 180.
Hope that helps.
Possibly Related Threads...
Thread:  Author  Replies:  Views:  Last Post  
Formula for converting angle to vector?  komirad  2  10,973 
Jul 29, 2011 07:29 AM Last Post: ThemsAllTook 

Question Regarding the Reflect Angle of a Transition  iBaby  3  3,844 
Apr 27, 2010 03:15 PM Last Post: JustinFic 

ending location from angle and speed  Kazooless  5  4,884 
Apr 3, 2009 02:40 PM Last Post: Gillissie 

calculating X and Y coordinates w/ an angle and distance  ferum  13  16,164 
Jun 25, 2008 10:53 PM Last Post: rosenth 

Convert vector to angle?  Leroy  35  34,203 
Jun 27, 2007 08:15 PM Last Post: unknown 