Skip to content

TriggerArea ​

Inherits: Area3D

Trigger area node that creates and manages its own TriggerAreaData in the database. Similar to NPC, each Trigger area automatically gets a TriggerAreaData when added to a WorldScene.

Description ​

Editor Mode:

  • Creates TriggerAreaData when placed in a valid WorldScene
  • Syncs position/rotation changes to database
  • Handles deletion cleanup

Runtime Mode:

  • Self-registers with ObjectRegistry
  • Manages activation based on quest objectives
  • Tracks player presence

Properties ​

TriggerAreaDatatrigger_area_data
Stringarea_name"":
Colordebug_colorVolumeDebug.TRIGGER_AREA:

Variables ​

String:display_name
boolentity_enteredfalse
intactive_references0

Methods ​

Array[Node3D]get_bodies_inside()
boolmatches_id( target_id: int )
voidset_active( active: bool )
voidadd_reference()
voidremove_reference()
intget_trigger_area_id()

Property descriptions ​

TriggerAreaData trigger_area_data ​

Reference to this trigger area's data in the database

String area_name = "": ​

Optional name for this area (used in quest descriptions) This is synced to trigger_area_data but kept as export for quick editor access

Color debug_color = VolumeDebug.TRIGGER_AREA: ​

The colour of the shape in the editor (and with Visible Collision Shapes): choose one to tell your trigger areas apart. A clear colour (alpha 0) leaves the colour Godot gives a shape

Variable descriptions ​

String: display_name ​

The name of the trigger area (the event triggers show it): the name set on the node, else the one of its data

bool entity_entered = false ​

Flag to check if a player has entered this area

int active_references = 0 ​

Number of active objectives referencing this area

Method descriptions ​

Array[Node3D] get_bodies_inside() ​

The bodies inside the trigger area right now. An area that is not watched (inactive) does not monitor, so this asks the physics space with the shapes of the trigger area instead: the conditions can ask about any trigger area at any time

bool matches_id( target_id: int ) ​

Is this the trigger area with this id?

void set_active( active: bool ) ​

Turns the trigger area on or off (it shows and detects only while on).

void add_reference() ​

A trigger that needs the trigger area asks for it: it turns on.

void remove_reference() ​

A trigger lets the trigger area go: it turns off when nobody needs it.

int get_trigger_area_id() ​

Get the trigger area ID (convenience method)