How to make AI move when im not looking but not move when I am look

Hey Guys, Im just Making a basic jump scare horror for my friend but i dont have any idea to make the blueprint. I want the character have the effect that it pop up behind the player then when the player look behind it magicaly appears there, its like a jumpscare effect. Please do tell me if im not explaining the problem well.

You could do a check to see if the AI object is being rendered which would be very accurate, but I suspect it will be difficult to do.

An easier approach would be to find the dot product of the forward vector of the active camera and a look at vector from the camera to the AI object.
Dotting the two vectors will give a result in the -1 to 1 range with -1 meaning the view is completely opposite where the object is, 0 meaning the object is perpendicular to the camera view, and 1 meaning the view is looking directly at the object.
Knowing the FOV of the camera, the size of the object, and a bit of trial and error, a cutoff value ensuring that the object is not in view can be found.

What is missing from this method is having the AI move when obscured by objects between the player view and the AI object itself. You could add some line traces from specific points on the AI object, if any of them reach the camera or player and the camera is within the cutoff point for visibility, it must be assumed that the player can see the AI object.

Alternately you could have limited visibility range and do a check if the camera is within that range.
Another way to overcome the player potentially locking the AI in place by keeping the camera pointed in its direction could be to simply teleport it away for a time and then reinsert it somewhere in the players vicinity.

Good luck scaring your friend :smiley: