Triggers are entities which respond to the presence of other entities. Trigger brushes can be created by mappers, while programmers can make anything into a trigger.
- All trigger entities must use this material on all faces.
- Filter entities can be used to restrict what activates the trigger.
- Filter Flags
- There are a series of flags that permit simple filtering without the need of a second entity.
- Outputs called whenever a entity matching all filters enters/leaves the trigger, regardless of whether it has passed any further tests. The entity that entered or left is the !caller.
- As above, but only called if there are no other (filtered) entities touching the trigger.
- One of these outputs will be fired in response to the
TouchTestinput. All triggers support this, but most do not have it listed in their FGD.
- Fires whenever an entity matches all of the trigger's criteria.
Warning: For a trigger_once, this output is not the same as
OnStartTouchAll. When a trigger that does not reset is activated, it removes itself from the map after 0.1 seconds.
OnStartTouch can still be re-triggered during that 0.1 second window.
- Brush entity
- Inputs and Outputs
showtriggers_toggle, a console command to make trigger brushes visible
All entities can respond to collisions with other entities (see
Touch()). If you want touches without actual collisions, then you have two options:
- This will cause the entity to receive touches as things pass through it.
- This will give the entity a "trigger box" that extends around its bounding box by iBloatSize units in X/Y and (iBloatSize/2) in +Z (-Z remains the same). The trigger box is world aligned and will work regardless of the object's solidity and collision group. It will be visible as a light blue box when the
ent_bboxconsole command is used.
- Valve use trigger boxes for all pickup items. Their bloat size is 24, a surprisingly large figure.
To make a new brush trigger, which tests using the shape of its brush model instead of a bounding box, inherit from
CBaseTrigger and call