Skip to content

Trigger

Trigger is an invisible volume that detects when entities enter and exit. Trigger derives from Entity so if you have a Trigger you can do any of these functions as well as the functions in Entity. You can do entity:IsA(Trigger) to see if a particular entity variable is a Trigger type entity.

Functions

Function Name Usage Description Notes
IsOverlapping bool triggerComponent:IsOverlapping(Entity entity) Returns whether a passed in entity is currently within the trigger
IsInside bool triggerComponent:IsInside(Vector worldPosition) Returns whether the point given (world space) is within the bounds of the trigger (whether the trigger is active or not)

Parameters

Parameter Name Usage Description Notes
playersOnly bool playersOnly Set whether the trigger should only overlap players or all entities.
size vector size The size of the trigger box
active boolean active The trigger box is active
interactable boolean interactable The trigger box is active
onTriggerEnter Event onTriggerEnter Called when this trigger volume is entered by a valid entity, with the Entity passed as an argument,
as well as the trigger Entity from which the onTriggerEnter event is sent.
An alternative to listening for OnTriggerEnter in a script on the entity.
onTriggerExit Event onTriggerExit Called when this trigger volume is exited by a valid entity, with the Entity passed as an argument,
as well as the trigger Entity from which the onTriggerExit event is sent.
An alternative to listening for OnTriggerExit in a script on the entity.

Overrides

Override Name Usage Description Notes
new_index trigger.var = object value