How would i make a npc that you can sneak behind him?

I want to make an enemy AI that you can sneak up behind him for example:

enemy is looking front and your behind him at that point he will not start following you
enemy is looking front and your on any of his sides at that point he will become alert and start following you
if you jump behind him when he was following you then he continues following

i haven’t tried any solutions i haven’t even made the enemy AI i just wanted to know for future projects i might do

use dot product to check if the player is in front or on any sides of the npc, if there is one then just use moveto to follow the player.

dot product tutorial:

i didn’t know that existed, ok i will try it out, thanks!

thank you very much that is exactly what i wanted to learn how to do!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.