Trigger Sensors

Trigger sensor component and sensor types — condition evaluation objects for physics, interact, and record-based world trigger activation.

TriggerSensorComponent is the condition container of the World Trigger system. It owns arrays of TriggerSensorType objects that define evaluation logic — collisions, interactions, record checks. When conditions pass, it fires WorldTriggerRequestBus::Trigger on the same entity.

For usage guides and setup examples, see The Basics: GS_Interaction.


Container Component

TriggerSensorComponent

Trigger Sensor component in the O3DE Inspector

Owns and evaluates all sensor type objects. Not subclassed — extended by adding TriggerSensorType objects to its arrays.

Bus: TriggerSensorRequestBus (ById, Single)

FieldTypeDescription
andConditionsvector<TriggerSensorType*>All types must pass for the trigger to fire.
orConditionsvector<TriggerSensorType*>Any type passing is sufficient to fire.
MethodReturnsDescription
DoActionvoidEvaluates all conditions. On pass, fires WorldTriggerRequestBus::Trigger and TriggerSensorNotificationBus::OnTriggered.
DoResetActionvoidEvaluates reset conditions and fires reset if they pass.

On Activate, automatically activates a PhysicsTriggerComponent on the entity if any sensor type returns true from NeedsPhysicsTrigger().


Base Type Class

TriggerSensorType

Abstract base for all sensor evaluation logic. Not a component — reflected manually in GS_InteractionSystemComponent::Reflect(). Subclass this to add new condition types.

VirtualReturnsDescription
Activate(entityId)voidCalled when the owning component activates. Connect to buses here.
Deactivate()voidCalled when the owning component deactivates. Disconnect from buses here.
EvaluateAction()boolReturns true if the condition is currently satisfied.
EvaluateResetAction()boolReturns true if the reset condition is satisfied. Returns true by default.
NeedsPhysicsTrigger()boolReturn true to signal that a PhysicsTriggerComponent should be activated. Returns false by default.
OnTriggerEnter(entity)voidCalled by the physics trigger when an entity enters the volume.
OnTriggerExit(entity)voidCalled by the physics trigger when an entity exits the volume.

Stores m_ownerEntityId for calling back to TriggerSensorRequestBus::DoAction() or DoResetAction() from event-driven types.


Built-in Sensor Types

SensorType_Collider

Physics overlap sensor. Returns NeedsPhysicsTrigger() = true, causing the owning component to activate a PhysicsTriggerComponent.

  • OnTriggerEnter stores the entering entity.
  • OnTriggerExit clears the stored entity.
  • EvaluateAction() returns true while a valid entity is present.
  • EvaluateResetAction() returns true when no entity is present.

SensorType_Record

Fires when a named save record changes to a configured value. Extends RecordKeeperNotificationBus — connects on Activate and fires DoAction automatically when the matching record changes.

  • EvaluateAction() calls GetRecord and compares against recordValue.

→ Record Sensor Type Reference

FieldDescription
recordNameName of the record to watch.
recordValueValue the record must reach to fire.

SensorType_Interact

Fires when any unit interacts with this entity via the targeting system. Extends InteractTriggerSensorRequestBus.

  • On interact: stores lastCaller and calls DoAction.
  • EvaluateAction() returns true while lastCaller is a valid entity.

SensorType_PlayerInteract

Player-only variant of SensorType_Interact. Extends SensorType_Interact and adds a tag check — lastCaller must have the "Player" tag for the condition to pass.


Extension Guide

To create a custom sensor type:

  1. Create a class extending TriggerSensorType.
  2. Override EvaluateAction() to define when your condition is satisfied.
  3. Override Activate(entityId) / Deactivate() to connect and disconnect from any buses.
  4. For event-driven evaluation, listen on a bus and call TriggerSensorRequestBus::DoAction(m_ownerEntityId) when the event fires — the component will run the full evaluation pipeline.
  5. Return true from NeedsPhysicsTrigger() if your type needs a physics volume.
  6. Reflect the class in GS_InteractionSystemComponent::Reflect() — types are not components and are not registered via CreateDescriptor().

See Also


Get GS_Interaction

GS_Interaction — Explore this gem on the product page and add it to your project.