Hey! I’m creating a horror game and are struggling with this:
There’s a scary invisible monster in a corridor, and a invisible box about 10 meters behind him, when you walk past the monster and look at the invisible box the scary monster spawns and if you after looking at the box look back a scary sound effect plays and the monster scares you.
That’s my basic idea and the rest I’m capable of implementing myself.
1. Trace for that box. So you trace a line from your camera(using its location and rotation values), if your trace hits that box(you get that information out of the HitInfo), then just fire an event. 2. use location and rotation of your character/camera and determine the dot product between where you are looking at(using rotation) and where the box is(using your position relative to the box). Then check if your rotation is in a certain threshold to fire the event.