How to tell if an object is in the Player's peripheral vision?

Hello! I need help with this.

I’m not asking for a full complete script, oh no no.

I’m just wondering if there’s a simplistic way to tell a branch that the player can see an actor. Examples like Slenderman and Weeping Angels are valid for what I’m trying to do here.

If anybody could help, that would be greatly appreciated.

Cheers :slight_smile:

-Get the player forward vector
-Get the vector between player and object
-Make a trace. If the object is not hit, it is occluded by a nearer object, thus not visible to the player.
-If visible, calculate the angle between the vectors
The greater the value, the more peripheral the obejct is. 90deg being at the edge. (Ofcource this depends on your FOV settings as well)

PS: In case you wonder:
The angle of two vectors is calculated as the arcossine of the quotient of the Dotproduct and the product of the vector lengths.
With a and b being vectors: Angle = arccos((a o b)/(|a||b|))
This is in radians. To convert to degrees, multiply by 180 and divide then by pi: deg = rad
180/pi