How do I get the measured angle between two vectors to be greater than 180 degrees in the angle function?

If I try to measure the angle between surface velocity and (0,1,0), it will always be between 0° and 180°, but heading can be between 0° and 360°.

I am trying to write a program that can tell the forward component (relative to a craft) of a vector only (ignoring sideways and vertical components), but because of the difference in the way heading angles work compared to the 'angle' function, my program isn't working properly from a heading of 181° to 359°. Is there an easier way to do this?

My current equation is: cosine(Heading - (angle between surface velocity and (0,1,0)) * (surface velocity) = forward velocity

Tags
Question

No Upvotes

Log in in to upvote this post.