What I want to do here is create a system where an enemy object has some kind of "sight", as in the enemy can detect a player object when the player object comes in its field of view. I am currently thinking of the following two ways:
- A spotlight that is parented to the enemy object acts as it's field of view.
- The enemy object casts multiple rays, with each ray being 5 degrees away from the previous one, creating an isosceles triangle of some sorts with rays between it.
The first method is problematic, and I do not know how to go about with the second method. How can I go about implementing it? Also, is there another way of doing the same that is better than the two methods listed above? If so, please do mention it.