Is there a way to make a "Look at" function to trigger events?

For example, if I look at a box, it should turn red, play a sound, or cause something else to trigger. I’m making a horror game involving ghosts and I would love to add in things like “shadow in the corner of your eye” gameplay where as soon as you turn to look, the object should disappear, or when you see a ghost a gasp sound should be played. Can anyone help?

There are a couple of different ways to model line-of-sight, which is essentially what you’re doing.
You could use a single sphere trace from the centre of the player camera in the direction of the camera’s forward vector. The sphere would essentially represent the area of the camera’s field of view which is not in the periphery. You’d probably need to set up a specific trace channel for this so that normal geometry doesn’t partially occlude your trace.

Another way I’ve seen this faked is to parent an invisible cone to the camera’s origin, pointing the base of the cone along the forward vector, and you can trigger effects if the invisible cone collides with your ghostly objects.

Lastly, you could use the dot product like this:

Evidently this is more mathematically oriented, and doesn’t take into account if some other object hides the ghost entirely, but you could combine it with the sphere trace, allowing the sphere to collide against other geometry, to handle that.

I decided to use the Sphere Trace method, and while I got the trace to work, the editor keeps crashing when I add an OnHIt node to the actors I want to affect and then try to play in the editor. I guess this is something I’ll have to wait on…