Angle between two vectors not calculating properly

The dot product alone is enough to tell you the direction (positive/negative).
You just need to dot the forward vector of the moving thing vs the location of the other item.

When facing away from it you will get a negative result. When looking towards it it will be a positive result.
(In most cases anyway? There’s edge situations where you may want to dot the cross of an actor Up vector/right vector or similar).

Dot should always range between -1 and 1.
Obviously dot is also a ratio of the angle needed to reach the rotation required to look at the object.

Unit circles and all that?
(If that doesn’t ring a bell, have a quick search online for a unit circle explanation)

Instead of using acosd you can just solve the angle value in degrees from the dot itself…
Making sure you preserve the sign…

1 Like