Im trying to use Vector2::Dot and Math::Acos to determine whether one gameobject is in front of another. With what I have, I'm able to get whether the first object's forward vector is at a perpendicular angle to second actor's forward vector:
float dotResult = Vector2::Dot(GetForwardDir(), secondActor->GetForward());
float angle = Math::Acos(dotResult);
if(angle <= minAngle)
//do something
Where GetForwardDir() is:
return Vector2(Math::Cos(mRotation), -Math::Sin(mRotation));
However this does not account for where the second actor is relative to the first actor. I don't think Im understanding something here about dotResult and the Acos angle.
How can I use this to get whether the first actor is in front of the second?