Download

Horror game line tracing help.

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.

you have two options:

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.

Is it possible to trace an invisible box? And if so, can you direct me to any information that can be helpful in order to perform it?

Well, you just have to use an actor with a collision setup. Thats it.

I just tested a trace against an actor that had the “Actor Hidden in Game” flag checked and it worked.