Table of Contents

Trigger Interaction

This interaction is used to detect when an object is touched by another. The most common case is when an object is touched with the controller or hand tracking, but it is also used to detect collisions with the Player or other objects.

The Trigger interaction consists of:

  • TriggerInteraction: which is the object on which it interacts.
  • TriggerSource: the interacting object. By default VIROO Interaction System provides the following: left hand and right hand, the index finger and the Player.

Add a Trigger Interaction to a GameObject

To add ray interaction to an object you must:

  1. Set up the Interactable Object with the necessary components.
  2. Add the Actions you want the object to trigger.

Set up the Trigger Interactable object

To make an object respond to a Trigger interaction it must have, at least, the following components.

  • TriggerInteraction: VIROO Interaction System component.
  • TriggerInteractableConfig: you must have a TriggerInteractableConfig. You can add one to this same GameObject or use an existing one in the scene. This component indicates against which Trigger Sources this object interacts.
  • Collider: this GameObject must have a Trigger type Collider.
TriggerSource
Field Description
Config The TriggerInteractableConfig associated with this interaction determines which TriggerSources collisions are detected.
Trigger Action Type You can choose to check when the Trigger action enters (Enter) or exits (Exit).
Actions The list of Actions that this interaction executes (see next item).

trigger-interaction.png

Define your own TriggerSource

In the TriggerInteractableConfig you can determine against which Sources this interaction detects collisions, you can add your own TriggerSources if needed.

To do so:

  1. In the GameObject against which this interaction detects collisions, add a TriggerSource component.
  2. Add a Rigidbody to this GameObject.
  3. In the TriggerId field write the label with which you want to identify this Source.
TriggerSource
Field Description
Trigger Id The text label with which this TriggerSource is identified.

trigger-interaction-trigger-source.png

When you return to the TriggerInteraction component, you will see that the new Trigger Source will appear among the available Trigger sources.

trigger-interaction-with-custom-trigger-source.png

Add Actions

At this point you can add the desired Actions for when the trigger interaction is performed by a user.

The TriggerInteraction Actions field supports dragging the actions triggered by this interaction. To see the actions available in VIROO go to Actions and to see how to create your own Custom Actions go to Extend the Interaction System.

Add to the scene the Action you want to perform when this interaction occurs, in this example we will be using a MoveAction.

trigger-interaction-move-action.png

And now, drag the MoveAction action to the Actions field of the TriggerInteraction.

trigger-interaction-actions.png