Hi, as illustrated in the picture and in the specific scenario where my player ship is more or less facing the back of the enemy and I want the enemy to detect this promptly and take evasive maneuvers by turning to the right of left but I have no idea how to code the detection. I’ve used Vector3.Dot to determine if the player is behind the enemy but I don’t think it detects whether the player is facing towards or away from the enemy.
Is it an option to compare the direction vectors of both the player and the enemy? If the difference between the two vectors is below a certain threshold they fly in the same direction. You could combine that with checking if the player’s location is within a certain cone behind the enemy to trigger the enemy to start a maneuver?
Put a collider to the back of the enemy. Fire a raycast from the player’s front and if it hits the collider, the player is facing his back.