AI that you have to avoid by going inside of crevices

Hello! Recently, I’ve been trying to make some unique horror game AI’s and I had an idea for something simple in concept, but unable to figure out how to make it.

Examine this image. The giant red part represents where the AI can walk. It can NOT stray off that path to get the player. The only way to get the player is if they are on the AI’s path and chasing the player.

Now, examine the wood plank boxes. These boxes represent areas you can go in to avoid the AI chasing you, when you are in one of these boxes, it will essentially act like you aren’t there.

How would I create this? Is there any resources I may learn/go off of? If you still don’t understand what I’m talking about, let me know! Thanks!

Region3 might be the way to go here.

1 Like

Raycasting:

1 Like

Interesting.

The way I would do it is to use FoV combined with Raycasting.

What I would do is check how far the player is away from the Z forward axis on the head of the enemy.
Then if the Player is in the FoV radius you can raycast to the players position.
If the Raycast Returns the player then you can say that the AI has seen the player.

2 Likes