# Source URL: https://dev.epicgames.com/documentation/en-us/fortnite/lights-and-bridges-03-trigger-component-and-triggerable-child-classes-in-fortnite
# Local doc: epic-docs/documentation/en-us/fortnite/lights-and-bridges-03-trigger-component-and-triggerable-child-classes-in-fortnite.md
# Section: TriggerComponent.verse
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /Verse.org/SceneGraph }
using { Logging }
trigger_component<public> := class<final_super>(component):
@editable
InteractionVolume<private>:volume_device = volume_device{}
@editable
OnlyTriggerChildren:logic = false
var InteractingAgents<private>:[]agent = array{}
# Called when an agent interacts with the volume
Interact():void=
for:
ChosenEntity : Entity.FindDescendantEntities(entity)
ChosenEntityComponent : ChosenEntity.GetComponents()
CastToInterface := triggerable[ChosenEntityComponent]
do:
if (OnlyTriggerChildren?):
if (Entity = ChosenEntity.GetParent[]):
CastToInterface.Trigger()
else:
CastToInterface.Trigger()
<# Events #>
# Event that is triggered when an Agent enters the InteractionVolume
OnAgentEntersVolume(Agent:agent):void=
set InteractingAgents += array{Agent}
Log("Agent enters volume", LogTriggerComponent)
Verse Library
verse
19 Triggercomponent Verse
Detects agent entry and exit in a volume, then triggers child components implementing a triggerable interface.
extracted-snippets/documentation/en-us/fortnite/lights-and-bridges-03-trigger-component-and-triggerable-child-classes-in-fortnite/19-triggercomponent-verse.verse
Sign in free to read the full source 🌴
This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.