I have a 3D object (an enemy) and I want to tell if the player is behind or in front of them.
I'm not sure how to do it.
Any help is welcome
I've tried this (eyeRot is the rotation of the enemy)
if(eyeRot>-1.2 && eyeRot<1.2):
print("PLAYER INFRONT: " + str(eyeRot) )
get_node("Sprite3D").show()
else:
print("BEHIND: " + str(eyeRot) )
But this doesn't work, as it prints positive if the player is in front or behind, and only prints negative if the player is to one of the sides.
What I'm trying to do is a basic cone of sight.