If i have a 2D direction vector, how can I get the facing in degrees? Thanks.
Z.
Printable View
If i have a 2D direction vector, how can I get the facing in degrees? Thanks.
Z.
"facing"?
tangent Theta = deltaY / deltaX
So, your vector may be in the form (Xstart,Ystart) to (Xend,Yend)
So
Theta = ArcTan ( (Yend-Ystart) / (Xend-Xstart) )
Watch your quadrant and radians/degrees
"atan2" can handle the the quadrant issue.
Degrees * PI / 180 = Radians
Much thanks =).
Z.