How to let your AI See
I have fixed the movement of the player. The guards also move with navmesh. Now we have to create the system present in all games with a stealth mechanic. The possibility of being discovered.
Right now I’m just referring to the guards and I need to create what simulates their field of view, what they see with their eyes.
There are several ways to get this result, I decided to manage it through the OnTriggerEnter method that recognizes the player when he enters and starts the game over sequence.
I added a cube, removed its mesh render, changed the size of its collider, and checked the IsTrigger box.
Finally, I put it as a child of my guard and repeated the operation for all other guards