written by Fidcal
The trigger_facing entity triggers any target if clipped by the player AND if the player is facing a set direction. This can be used:
- To make sure a player sees something when a trigger operates (eg, to make sure the player does not miss seeing a silent secret door opening if they are looking the other way when they pull a lever)
- To trigger something when the player sees something (eg, the player looks through a spooky window and this causes a ghost to wander across at that exact moment.)
trigger_facing is set up like this...
- Create a brush the volume of which the player must be inside when it is to trigger.
- Assign it entity trigger_facing. This automatically textures it in Multi Trig (though by default it is single)
- Give it the property angle from 0 to 360 with the direction you wish the player to be facing when it triggers, eg, as follows in plan (top) view...
- 0 = East (X)
- 90 = North (Y)
- 180 = West (-X)
- 270 = South (-Y)
- 360 = East(X)
- The viewing angle is always plus or minus 30 degrees so eg, 180 would trigger if the player is facing 165 to 195. It is also affected if the player looks up or down outside 30 degrees of the horizontal. As far as I can tell you cannot set it to trigger if the player is facing up or down; it only seems to work horizontally.
- Give it the property target with a value of any entity you wish to trigger, eg, a light
- Multiple targets as usual with target0, target1, target2 etc each with their own entity to target.
By default it will only trigger once. To make it trigger any number of times give it the property wait with the value in seconds between triggering from 0.01 seconds upwards. So for say, a flickering light you might set it to 0.01 or you might set it to say 30 if you don't want it to trigger again for half a minute. If set to -1 it will only trigger once (default)
To recap: the player must still clip into the 'trigger_facing brush and they must also be facing the set direction. They can back into the brush and it will still trigger if they are facing the correct direction within plus or minus 30 degrees.