Triggers
Learn how use Triggers in your VIVERSE Worlds, and how to link them to Actions and / or Custom Scripts
About
Triggers is a fundamental part of VIVERSE Framework, allowing creators to handle a wide range of player- and game-specific events without writing a single line of code! Whenever Player interacts with some Entity — be it a click, or collision, or seat taking — a corresponding event is generated, and any Trigger, associated with this event, also gets activated.
Usage
Triggers don't do anything on their own — they're typically paired with Actions or Custom Scripts to produce desired effects of their activations.
Here is a simple example of using Trigger with an Action:
Setup Trigger
Create a new empty Entity in your Scene
Add 3D > Render Component of type
Box. Your Entity should be visible in your Scene nowAdd Physics > Collision Component of type
Boxas well. Adjust its params if necessaryClick Add Viverse Component button and select Rule > Trigger. The
viverseTriggerscript will be added to your EntityIn Trigger Component, add a new entry to the Trigger List, by entering 1
Leave Trigger type at
OnSelect(default), and give it a uniqueName, for examplebox.clicked
Setup Action
With your Entity selected, click Add Viverse Component button once again, and select Rule > Action. The
viverseActionscript will be added to your EntityIn Action Component, add a new entry to the Action List, by entering 1
Populate
Trigger / Conditionfield with your Trigger Name, which isbox.clickedin our caseLeave all other params at their defaults -
ToggleEntities,Toggle,Self






It's not really necessary to have both Trigger and Action Components on the same Entity! For the purpose of your experience you can have as many Entities as you like, each with its own Trigger or Action, or a combination of those.
The only important rule is that Trigger's Name param should match an Action's Trigger / Condition one if you want them to be linked together
Reference
OnSelect
Activates when the Player points and clicks on this Trigger. Requires Collision Component to be attached to the Entity

OnCollision
Activates when another Rigidbody interacts with this Trigger. Supported interactions:
TriggerEnter/TriggerLeaveRequires Collision Component to be attachedCollisionStart/CollisionEndRequires both Collision and Rigidbody Components
You can allow interactions with only the Player and / or some Entity with specific Tag. See Collision Filter for available options


OnAnimation
Activates when animation state changes for this Trigger entity. Requires Animation Component to be attached. Supported animation events:
Start/End/CustomEvent

On
SeatState
Changed
Activates when this Seat Entity changes its state. Works in tandem with Seat Component, therefore requires viverseSeat script to be attached to this Entity. Supported events:
Occupied/Vacated

On
Notification
Event
Activates when another Entity with Action Component fires PublishNotification event with particular Event Name matching the one in this Trigger. You can use it to send / receive custom Notification Events between different Entities in your Scene

On
Action
Executing
Activates when another Entity with Action Component starts executing an Action with a given Action Name. You can use it to sequentially chain multiple Triggers and Actions together, for example Trigger A → Action A → Trigger B → Action B

Last updated
Was this helpful?