more fun with vectors...whooohooo

Blitz3D Forums/Blitz3D Programming/more fun with vectors...whooohooo

Craig H. Nisbet(Posted 2008) [#1]
Last thing about vectors, I promice. How do I get the angle of vectorB relative to vectorA?


tonyg(Posted 2008) [#2]
atan2


Craig H. Nisbet(Posted 2008) [#3]
That doesn't really answer my question. Far as I can tell, that will give me the angle of a vector, which is great if your need angle relative to the world, but I need the angle relative to the angle of the first vector, vectorA. Or am I missing something.


big10p(Posted 2008) [#4]
Basically, subtract the angle of vectorA from the angle of vectorB.

This will give the angle vectorA needs to be rotated by in order to match vectorB.

There are actually 2 delta angles between vectors, though, so if you want the smallest one, you'll need to check if the delta is > 180 degrees.