πͺ€ Trigger
A Trigger class is a utility class to trigger events when any Entity enters an Area.
πAuthority
πͺInheritance
This class shares methods and events from Base Entity, Base Actor.
π§βπ»API Source
This page is auto-generated! The Functions, Properties and Events described here are defined in our GitHub's API Repository! Feel free to commit suggestions and changes to the source .json API files!
π Examplesβ
local sphere_trigger = Trigger(Vector(-200, 100, 500), Rotator(), Vector(100), TriggerType.Sphere, true, Color(1, 0, 0))
sphere_trigger:Subscribe("BeginOverlap", function(trigger, actor_triggering)
Console.Log("Something entered my Sphere Trigger")
end)
local box_trigger = Trigger(Vector(300, 200, 500), Rotator(0, 45, 0), Vector(150, 150, 150), TriggerType.Box, true, Color(0, 1, 0))
box_trigger:Subscribe("BeginOverlap", function(trigger, actor_triggering)
Console.Log("Something entered my Box Trigger")
end)
box_trigger:Subscribe("EndOverlap", function(trigger, actor_triggering)
Console.Log("Something left my Box Trigger")
end)
(Trigger.SetOverlapOnlyClasses) Sets to only overlap Characters
my_trigger:SetOverlapOnlyClasses({ "Character", "CharacterSimple" })
π Constructorsβ
Default Constructor
No description provided
local my_trigger = Trigger(location, rotation, extent, trigger_type?, is_visible?, color?, overlap_only_classes?)
Type | Name | Default | Description |
---|---|---|---|
Vector | location | Required parameter | No description provided |
Rotator | rotation | Required parameter | No description provided |
Vector or float | extent | Required parameter | Size of the Trigger. If using TriggerType.Sphere it is treated as radius, otherwise as Vector extent |
TriggerType | trigger_type | TriggerType.Sphere | No description provided |
boolean | is_visible | false | Useful for debugging |
Color | color | Color.RED | Color to paint the Trigger bounds - if Visible |
table of string | overlap_only_classes | {} | Filter Trigger to only overlap specific Classes. Leave it empty for all Classes |
πΏ Static Functionsβ
Inherited Entity Static Functions
This class doesn't have own static functions.
π¦ Functionsβ
Inherited Entity Functions
Inherited Actor Functions
Returns | Name | Description | |
---|---|---|---|
ForceOverlapChecking | Forces a Overlap checking to occur, will immediately trigger overlaps | ||
![]() | SetColor | Sets the Trigger color (if visible) | |
SetExtent | Sets the extent size of this trigger (sphere triggers can receive as float for radius) | ||
SetOverlapOnlyClasses | Sets the filter to Trigger to only overlap specific Classes. Leave it empty for all Classes |

ForceOverlapChecking
Forces a Overlap checking to occur, will immediately trigger overlaps
my_trigger:ForceOverlapChecking()

SetColor
Sets the Trigger color (if visible)
my_trigger:SetColor(color)
Type | Parameter | Default | Description |
---|---|---|---|
Color | color | Required parameter | No description provided |

SetExtent
Sets the extent size of this trigger (sphere triggers can receive as float for radius)
my_trigger:SetExtent(extent)

SetOverlapOnlyClasses
Sets the filter to Trigger to only overlap specific Classes. Leave it empty for all Classes
my_trigger:SetOverlapOnlyClasses(overlap_only_classes)
Type | Parameter | Default | Description |
---|---|---|---|
table of string | overlap_only_classes | Required parameter | No description provided |
Trigger.SetOverlapOnlyClasses Examples
π Eventsβ
Inherited Entity Events
Inherited Actor Events
Name | Description | |
---|---|---|
BeginOverlap | Triggered when something overlaps this Trigger | |
EndOverlap | Triggered when something leaves this Trigger |

BeginOverlap
Triggered when something overlaps this Trigger
Trigger.Subscribe("BeginOverlap", function(self, entity)
-- BeginOverlap was called
end)
Type | Argument | Description |
---|---|---|
Trigger | self | The Trigger entity |
Base Actor | entity | Any Actor which overlaps |

EndOverlap
Triggered when something leaves this Trigger
Trigger.Subscribe("EndOverlap", function(self, entity)
-- EndOverlap was called
end)
Type | Argument | Description |
---|---|---|
Trigger | self | The Trigger entity |
Base Actor | entity | Any Actor which left the Trigger |