Hello there guys, I am creating a game based on arena matches, with RPG style fights. I want some abilities to be more poweful (or only usable) when you are facing the enemy's back.
Assuming I have two entities (player or AI controlled pet) and that I know their positions and looking angles, is there any direct way to find the if one is facing the back of the other?
Right now I am using a quadrant approach, for instance If I had two entities A and B and I wanted to know if A is on B's back.
1) I define which quadrant B is relatively to A (assuming A's position as the origin).
2) I add and subtact 45º from A's looking angle and find the quadrants of those resulting angles (I assume the front is 90º wide).
3) If B is on one of those quadrants and its looking angle is in the interval defined in the former step, then A is on B's back.
But I am wondering if there is a better approach?
Thanks in advance.