Skip to main content

Trigger

The Trigger class extends Actor and creates a shape-based volume in the world that detects when other actors overlap it. Triggers are useful for gameplay logic like entering zones, starting scripted events, teleporting players, or detecting proximity. Supported shapes include spheres, boxes, and capsules.

tip

Trigger is an Actor, so it inherits all functions from Actor.


Constructor

// Triggers are spawned via Lua scripting.

Constructor Parameters

NameTypeDefaultDescription
LocationVector(0,0,0)World position for the trigger.
RotationRotator(0,0,0)World rotation.
ExtentVector(100,100,100)Shape extents (radius, box half-size, or capsule radius/height).
TriggerTypeenumTriggerType.SphereShape of the volume -- Sphere, Box, or Capsule.
bVisiblebooleanfalseIf true, draws a semi-transparent debug shape.
CallbackFunctionfunctionRequiredFunction called on actor overlap. Receives (self, otherActor).
ColorColor(0,1,0,0.5)Debug color if visible.
OverlapOnlyClassestable{}Optional array of UClass paths to restrict overlap (e.g., only "/Script/Engine.Pawn").

Examples

Safe Zone

// Triggers are created and managed via Lua scripting.

note

When bVisible is set to false (the default), triggers are invisible in-game and have no visual representation. Set bVisible to true during development for debugging purposes.