Table of Contents

Poke Interaction

This interaction allows users to interact with objects in by simply "poking" them with their controllers. It's a quick and intuitive way to interact with buttons, triggers, or other UI elements in VR.

The Poke interaction consists of:

  • Poke Interactor: XRPokeInteractor is the interactor which performs this kind of interaction. This component is provided by Unity´s XR Interaction Toolkit. By default VIROO provides already configured Poke Interactors attached to the controllers and hands.
  • Simple Interactable: XRSimpleInteractable is the component with which XRDirectInteractor interacts.
  • Poke Filter: XRPokeFilter is the component that allows for basic poke functionality and to define constraints for when the interactable will be selected.
  • Viroo XR Simple Interactable: this component is in charge of configuring the way XRSimpleInteractable interacts with the interactors and also that the interaction events are triggered by networking.

Add a Poke Interaction to a GameObject

To add poke interaction to an object you must:

  1. Set up the Interactable Object with the necessary components.
  2. Configure the events you want to handle.

Set up the Interactable object

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

  • XRSimpleInteractable: Unity´s XR Interaction Toolkit component.
  • XRPokeFilter: Unity´s XR Interaction Toolkit component.
  • Collider: this GameObject or its children must have one or more colliders.
  • NetworkObject: necessary to identify the GameObject by Networking.
  • VirooXRSimpleInteractable: necessary to setup how XRSimpleInteractable is interacted and to launch the events through the Network.

XRSimpleInteractable

This is a Unity´s XR Interaction Toolkit component and is the simplest version of an Interactable object. It is intended to be used as a way to respond to interaction events with no underlying interaction behavior. For more information please refer to the official documentation here.

XRPokeFilter

This is a Unity´s XR Interaction Toolkit component and is a key component that works alongside the XR Poke Interactor to define how objects respond to poking gestures.

The XRPokeFilter acts like a gatekeeper for poke interactions. It determines:

  • Direction: In which direction (X, Y, Z axis) a poke needs to occur for the object to be considered "poked."
  • Sensitivity: The allowed angle deviation from the defined direction. A poke within this angle threshold will be recognized.

poke-filter.png

Collider

For Poke Interactor to interact with Simple Interactable, it is necessary that there is at least one collider, which can be at the same level of the component or in one of its children. The collider can NOT be of type Trigger.

NetworkObject

For network functions to work properly, interacting components need this component that uniquely identifies them across the network. It is therefore important to ensure that their ObjectId identifier is not repeated.

VirooXRSimpleInteractable

This VIROO component is necessary to setup how XRSimpleInteractable is interacted and to launch the events through the Network.

The XRSimpleInteractable component by default does not differentiate if it is being interacted by a Direct Interactor, Poke Interactor, Ray Interactor or a Gaze Interactor, that is why VIROO, through this component, provides a way to limit the way in which it interacts with this interactable in order to configure it so that it can only be interacted by an interactor of one type and not by both.

Field Description
Send Network Events If this box is checked the events triggered by the XRSimpleInteractable (HoverEnter, Activate...) will be networked, otherwise the events will be triggered only locally.
Allow Direct Interaction If this checkbox is checked it means that the associated interactable will interact with a Direct Interactor or Poke Interactor.
Interact With Hands In this field you can specify whether the interactable is hand-interactable. It has four possible values, None, Left, Right, Both. Allow Direct Interaction must be checked.
Tag Filters If you want the interactable to interact only with specific DirectInteractors, you can define tags for this purpose. For more information check the Custom Direct Interactors section in this page. Allow Direct Interaction must be checked.
Allow Ray Interaction If this checkbox is checked it means that the associated interactable will interact with a Ray Interactor and Gaze Interactor.
Allow Distance Select Interactor Check this checkbox to allow interactable be selected remotely through a Ray Interactor instead of having to use a Direct Interactor. It is commonly used to be able to grab objects from a distance.

Normally the standard configuration when we want to have a Direct Interaction is to have Allow Direct Interaction enabled and Allow Ray Interaction disabled. But, since doing poke interaction in desktop mode is complicated, we recommend to enable Allow Ray Interaction as well.

viroo-simple-interactable-direct-interaction.png

Configuring the Events

At this point you can use XRSimpleInteractable events to trigger logic when Poke interaction happens. VIROO Interaction System ensures that XRSimpleInteractable events are propagated over the network to all users if Send Network Events is selected. With this, the events you subscribe will be called to all users in the VIROO Application.

If you want to use the VIROO Interaction System Actions and you are sending events through the network, you must use the LocalExecute functions (instead of Execute).

In the following example a MoveAction is triggered when the object is poked.

poke-interaction-event.png

Here are the most common events that are used when performing Direct Interaction.

Event Description
SelectEntered The event that is called when an Interactor selects this Interactable. This is a generic event when an Interactor wants to select (grab) an Interactable, such as from a grab button press on a controller or a keyboard interaction on Desktop.
SelectedExited The event that is called when an Interactor deselects this Interactable. This is a generic event when an Interactor wants to deselect (ungrab) an Interactable, such as from a grab button release on a controller or a keyboard interaction on Desktop.
Activated The event that is called when the selecting Interactor activates this Interactable. This is a generic event when an Interactor wants to activate an Interactable, such as from a trigger pull on a controller or mouse down on Desktop.
Deactivated The event that is called when an Interactor deactivates this Interactable. This is a generic event when an Interactor wants to deactivate an Interactable, such as from a trigger release on a controller or mouse up on desktop.

A complete list of all events is available here