๐ชค Trigger
A Trigger class is a utility class to trigger events when any Entity enters an Area

๐ชInheritance
This class shares methods and events from Base Entity, Base Actor.
๐ 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?)
Parameters
| Name | Type | Description |
|---|---|---|
location | Vector | World location to spawn at |
rotation | Rotator | World rotation to spawn with |
extent | Vector or float | Size of the Trigger. If using TriggerType.Sphere it is treated as radius, otherwise as Vector extent |
trigger_type? | TriggerType | Shape of the Trigger, sphere or box Default TriggerType.Sphere |
is_visible? | boolean | Useful for debugging Default false |
color? | Color | Color to paint the Trigger bounds - if Visible Default Color.RED |
overlap_only_classes? | table of string | Filter Trigger to only overlap specific Classes. Leave it empty for all Classes Default {} |
๐ฟ Static Functionsโ
This class doesn't have own static functions.
Inherited static functions
From Entity11 functions
Events
Subscribe, UnsubscribeNetwork
SubscribeRemoteQueries
GetAll, GetByIndex, GetCount, GetPairs๐ฆ Functionsโ
ForceOverlapChecking | Forces an Overlap check to occur, will immediately trigger overlaps | |
IsOverlapping: boolean | Returns if an Actor is inside this Trigger right now | |
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 |
Inherited functions
From Actor60 functions
Appearance
GetDistanceFromCamera, GetScreenPercentage, IsVisible, SetCastShadow, SetHighlightEnabled, SetOutlineEnabled, SetRenderCullDistance, SetVisibility, WasRecentlyRenderedAttachments
AttachTo, Detach, GetAttachedEntities, GetAttachedTo, GetAttachedToSocket, GetSocketTransformLifecycle
GetLifeSpan, SetLifeSpanNetwork
GetDimension, GetNetworkAuthority, HasNetworkAuthority, IsNetworkDistributed, SetDimension, SetDistanceOptimizationMultiplier, SetNetworkAuthority, SetNetworkAuthorityAutoDistributedFrom Entity21 functions
Data
GetAllValuesKeys, GetValue, SetValueEvents
Subscribe, UnsubscribeLifecycle
Destroy, FinishSpawn, IsBeingDestroyed, IsSpawned, IsValid, SetSpawnModeNetwork
BroadcastRemoteEvent, BroadcastRemoteInRadiusEvent, CallRemoteEvent, CallRemoteEvent, CallRemotePlayersEvent, HasAuthority, SubscribeRemoteQueries
GetID
ForceOverlapCheckingSlowโ
Forces an Overlap check to occur, will immediately trigger overlaps
my_trigger:ForceOverlapChecking()

IsOverlappingModerateโ
Returns if an Actor is inside this Trigger right now
Tests the Actor's location against the Trigger's shape at the moment of the call
local ret = my_trigger:IsOverlapping(actor)
Parameters
| Name | Type | Description |
|---|---|---|
actor | Base Actor | The Actor to test |
Returns
| Type | Description |
|---|---|
| boolean | Whether the Actor is inside |

SetColorOptimalโ
Sets the Trigger color (if visible)
my_trigger:SetColor(color)
Parameters
| Name | Type | Description |
|---|---|---|
color | Color | The new Trigger color |

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

SetOverlapOnlyClassesModerateโ
Sets the filter to Trigger to only overlap specific Classes. Leave it empty for all Classes
my_trigger:SetOverlapOnlyClasses(overlap_only_classes)
Parameters
| Name | Type | Description |
|---|---|---|
overlap_only_classes | table of string | The new filter to Trigger to only overlap specific Classes. Leave it empty for all Classes |
Examples (1)
Sets to only overlap Characters
my_trigger:SetOverlapOnlyClasses({ "Character", "CharacterSimple" })
๐ Eventsโ
BeginOverlap | Triggered when something overlaps this Trigger | |
EndOverlap | Triggered when something leaves this Trigger |
Inherited events
From Actor5 events
From Entity4 events
All events
ClassRegister, Destroy, Spawn, ValueChange
BeginOverlapโ
Triggered when something overlaps this Trigger
Trigger.Subscribe("BeginOverlap", function(self, entity)
-- BeginOverlap was called
end)
Arguments
| Name | Type | Description |
|---|---|---|
self | Trigger | The Trigger entity |
entity | Base Actor | Any Actor which overlaps |

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


