Trigger proximity: Difference between revisions
Jump to navigation
Jump to search
Note:This entity cannot reliably detect when an entity exits the radius, which makes it only useful for detecting when one entity approaches another. This is due to the
Tip:The main use of this entity is to detect proximity to a dynamic entity that can rotate, since the detection area is a consistent sphere. Spherical parented triggers are possible, but spherical brushes are not recommended.
Note:This entity does NOT work well in MP maps. It will function, but it will then break all other triggers in the map if you have multiple players in the map. Solo will show all the triggers working correctly though.
m (note that this does not work in mp maps) |
No edit summary |
||
(10 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{LanguageBar}} | ||
{{CD|CTriggerProximity|file1=trigger.cpp}} | |||
{{this is a|brush entity|name=trigger_proximity}} It measures the distance of an entity within the [[trigger]] volume from a given point (and within a given radius). The ''NearestEntityDistance'' output will be 0 when the entity is at the center point, and 1 when the entity is at the radius. | |||
{{note|This entity cannot reliably detect when an entity exits the radius, which makes it only useful for detecting when one entity approaches another. This is due to the <code>NearestEntityDistance</code> output only firing while the entity is inside the radius, and that it sends a parameter of only 0 or 1, depending on if the entity is near the center (0) or at the edge (1). These are the only times that the parameter changes. Use the <code>OnEndTouch</code> output of [[trigger_multiple]] instead to detect when the entity moves away.}} | {{note|This entity cannot reliably detect when an entity exits the radius, which makes it only useful for detecting when one entity approaches another. This is due to the <code>NearestEntityDistance</code> output only firing while the entity is inside the radius, and that it sends a parameter of only 0 or 1, depending on if the entity is near the center (0) or at the edge (1). These are the only times that the parameter changes. Use the <code>OnEndTouch</code> output of [[trigger_multiple]] instead to detect when the entity moves away.}} | ||
Line 7: | Line 8: | ||
{{note|This entity does NOT work well in MP maps. It will function, but it will then break all other triggers in the map if you have multiple players in the map. Solo will show all the triggers working correctly though.}} | {{note|This entity does NOT work well in MP maps. It will function, but it will then break all other triggers in the map if you have multiple players in the map. Solo will show all the triggers working correctly though.}} | ||
==Keyvalues== | == Keyvalues == | ||
{{KV|Point to Measure From|target_destination|The name of the target entity, the origin of which is the point to measure another entity's distance from.}} | {{KV Targetname}} | ||
{{KV|Radius to measure within| | {{KV|Point to Measure From|intn=measuretarget|target_destination|The name of the target entity, the origin of which is the point to measure another entity's distance from.}} | ||
{{KV | {{KV|Radius to measure within|intn=radius|float|The radius to which the distance should be mapped. Entities outside the radius will be ignored.}} | ||
{{KV BaseTrigger}} | |||
==Flags== | == Flags == | ||
{{Fl | {{Fl BaseTrigger}} | ||
==Inputs== | == Inputs == | ||
{{I | {{I BaseTrigger}} | ||
==Outputs== | ==Outputs== | ||
{{ | {{O|NearestEntityDistance|activator=the nearest entity to the measure target that is touching this trigger{{confirm}}|param=float|Fired continuously when entities are touching the trigger volume. <br/>The output parameter is the distance from the Point to Measure From to the nearest entity that passed the trigger filters. <br/>The distance is mapped to the radius distance, so it will be 0 when the entity is on the point, and 1 when the entity is at the edge of the radius.}} | ||
{{O | {{O BaseTrigger}} | ||
{{sensor brush}} | {{sensor brush}} | ||
[[Category:IO System]] | [[Category:IO System]] |
Latest revision as of 03:52, 29 June 2025
![]() |
---|
CTriggerProximity |
![]() |
trigger_proximity
is a brush entity available in all Source games. It measures the distance of an entity within the trigger volume from a given point (and within a given radius). The NearestEntityDistance output will be 0 when the entity is at the center point, and 1 when the entity is at the radius.

NearestEntityDistance
output only firing while the entity is inside the radius, and that it sends a parameter of only 0 or 1, depending on if the entity is near the center (0) or at the edge (1). These are the only times that the parameter changes. Use the OnEndTouch
output of trigger_multiple instead to detect when the entity moves away.

Keyvalues
- Name (targetname) <string>[ Edit ]
- The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g.
parentname
ortarget
).
Also displayed in Hammer's 2D views and Entity Report.See also: Generic Keyvalues, Inputs and Outputs available to all entities
- Point to Measure From (measuretarget) <targetname>
- The name of the target entity, the origin of which is the point to measure another entity's distance from.
- Radius to measure within (radius) <float>
- The radius to which the distance should be mapped. Entities outside the radius will be ignored.
|
Flags
|
Inputs
|
Outputs
- NearestEntityDistance <float >
- !activator = the nearest entity to the measure target that is touching this trigger[confirm]
!caller = this entity
Fired continuously when entities are touching the trigger volume.
The output parameter is the distance from the Point to Measure From to the nearest entity that passed the trigger filters.
The distance is mapped to the radius distance, so it will be 0 when the entity is on the point, and 1 when the entity is at the edge of the radius.
|