trigger_look

From Valve Developer Community

Jump to: navigation, search

This is a brush entity available in all Source games.

Contents

Entity Description

A brush entity used to trigger something when the player looks at something.

It fires OnTrigger when the player looks at a target entity for the given amount of time while within the trigger volume. If the player leaves the trigger or looks away from the target entity, the clock resets.

If the Use Velocity instead of facing spawnflag is checked, the trigger uses the player's velocity instead of the player's view, so it determines whenever the player is moving toward the target entity; this is useful for triggering when players are driving a vehicle at something.

Note:Only designed for single-player games.
Note:As long as the player is touching the entity, facing the direction of the target entity will trigger it even if the target is not directly visible to the player (i.e. if there is world geometry in the way).
Note:In Portal, looking at the target entity through a portal will not fire the OnTrigger.

Availability

This brush-based entity is available in: all Source games. In code it is represented by class CTriggerLook, defined in triggers.cpp.

Keyvalues

  • TriggerOnce:

Filter Name <targetname>
Filter to use to see if activator triggers me. See filter_activator_name for details.

Origin:

Origin <origin>
The position of this entity's center in the world. Rotating entities typically rotate around their origin.

EnableDisable:

Start Disabled <bool>
Stay dormant until activated (probably with the Enable input).

Parentname:

Parent <targetname>
Specifies the targetname of this entity's movement parent. Entities with parents move with their parent.
Warning:See the warning under Counter-Strike Round Restarts before using the Parent field in CS:S.
Note:If a trigger does not start out with a parent, but rather gets one during run-time, this value should be set to a static entity. This is so the entity's solidity is set to VPhysics rather than BSP.

Global:

Global Entity Name <string>
Name by which this entity is linked to another entity in a different map. When the player transitions to a new map, entities in the new map with global names matching entities in the previous map will have the previous map's state copied over to them.

Targetname:

Name <string>
The targetname other entities refer to this entity by.
  • target
<target_destination> The name of the entity to be looked at.
  • LookTime
<string> The time, in seconds, that the player must look the target before firing the output. Resets if player leaves trigger, or looks outside the Field of View threshold.
  • FieldOfView
<string> How close the player has to be looking at the target. 1.0 = straight ahead\n 0.0 = +/- 90 degrees\n -1.0 = all directions).
  • Timeout
<float> The time, in seconds, to wait after player enters the trigger before firing the OnTimeout output, 0 = never.

Flags

  • Applies to clients (players)
  • Applies to NPCs
  • Applies to pushables
  • Applies to physics objects
  • Applies to player ally NPCs
  • Applies to clients in vehicles
  • Applies to everything
  • Applies to clients not in vehicles
  • Applies to physics debris
  • 128 : Fire Once
  • 256 : Use Velocity instead of facing

Inputs

  • Trigger:

TouchTest (New with Orange Box)
Triggers either the OnTouching or OnNotTouching outputs for whether anything is touching this entity.

TriggerOnce:

Toggle
Toggles this trigger between enabled and disabled states.

EnableDisable:

Enable
Disable
Enable/disable this entity from performing its task. It might also disappear from view.

Parentname:

SetParent <targetname>
Move with this entity. See Entity Hierarchy (parenting).
SetParentAttachment <string>
Attach to a named attachment on the current parent. The entity will teleport so that the position of its root bone matches that of the attachment.
SetParentAttachmentMaintainOffset <string>
As above, but without teleporting. The entity retains its position relative to the attachment at the time of the input being received.
ClearParent
Removes this entity from its current movement hierarchy.

Targetname:

Kill
Removes this entity from the world.
KillHierarchy
Removes this entity and all its children from the world.
AddOutput <string>
Evaluates a keyvalue/output on this entity. It can be potentially very dangerous, use with care.
Format: <key> <value>
Format: <output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire, -1 means infinite>
FireUser1 to FireUser4
Fire the OnUser outputs; see User Inputs and Outputs.

Outputs

  • Trigger:

OnEndTouch
Fired when an entity stops touching this trigger. Only entities that passed this trigger's filters will cause this output to fire. (activator is the exiting entity)
OnEndTouchAll
Fires when the last entity in the entity's area exits this trigger or when this entity is disabled. Only entities that passed this trigger's filters are considered. (activator is the last exiting entity)
OnTouching (New with Orange Box)
OnNotTouching (New with Orange Box)
Fired when the TouchTest input is called.

TriggerOnce:

OnStartTouch
Fired when an entity starts touching this trigger. The touching entity must pass this trigger's filters to cause this output to fire. (activator is the toucher)
OnTrigger
Fired whenever the trigger is activated. (activator is the activator)

Targetname:

OnUser1 to OnUser4
Fired in response to the FireUser inputs; see User Inputs and Outputs.
OnKilled (New with Left 4 Dead)
Fired when the entity is killed and removed from the game.
  • OnTimeout
Fired after the timeout interval expires if the player never looked at the target.
Personal tools