trigger_look

From Source Entities
Jump to navigation Jump to search

Code classes:

Trigger.png

trigger_look is a brush entity present in all Source games. It fires an output when a player is inside it and looks at a certain spot. Designed for singleplayer. Results will vary in multiplayer. Does not work at all in Css.png.Tested in: Css.pngL4d2-small.pngP2.pngCsgo-small.png

Note: Does not work through P1.pngP2.pngportals.

Note: The entity does not check if the player has a line of sight to the target; only if they're facing its direction.

Bug: If multiple entities in the map have the same name as the target entity, then OnTrigger may fire inconsistently. The output may either be delayed or never fire at all. These effects seem to worsen the more offending entities there are in the map.

Flags[edit | edit source]

  • 128: Fire Once - Entity removes itself after firing.
  • 256: Use Velocity instead of facing - Use the direction the player is going in, instead of the direction they're looking in.

Keyvalues[edit | edit source]

Look Target (target) <target_destination>
The name of the entity to be looked at.
LookTime (LookTime) <float>
Player must look at the target for this long before firing the output.
FieldOfView (FieldOfView) <float>
How closely the player must be looking towards the Look Target to fire the output. 1.0 = directly at it, 0.0 = 90 degrees away, -1.0 any direction.
Timeout (Timeout) <float>
If non-zero, how long to wait for the player to look towards the target once they're inside the trigger. See OnTimeout.
Note: When this keyvalue is set, the outputs will not fire again if one has already, until the player leaves and reenters the trigger. To do: Is that a bug?

Inputs[edit | edit source]

LookTime (Not in FGD) <float>
Sets LookTime.
FieldOfView (Not in FGD) <float>
Sets FieldOfView.

Outputs[edit | edit source]

OnTrigger
Fires when the player has been inside the trigger and has been looking at the Look Target for the amount of time specified by LookTime.
OnTimeout
Fires when the player has been inside the trigger but did not look at Look Target for the time specified in LookTime within the time specified in Timeout.