AI should only be able to move if player doesnt see it


i want to create an AI that is only able to move if the player doesnt look at it/see it.

Is there a simple solution for that?

Just use a bool to enable/disable movement. Set the bool whenever the player looks at the ai.

sounds good, and how to make the “player looks at the ai”?

No one?
Help pls :confused:

There are plenty of tutorials on youtube for this. Just google AI vision check or something. Then use the blueprint code on your player instead on your NPC.

Do a LineTraceByChannel and check if the linetrace is hitting your AI.If it hits the AI its visible to the player, if the linetrace does not hit the AI, your AI is not visible for the player.

I think maybe better solution would be to determine an angle between player’s forward vector and npc trace vector, and block movement only if it is less than FOV of the camera.