Table of Contents

Grab Interaction

This interaction is used to perform grab interactions with any of the platforms that VIROO supports:

  • XR with controllers: touch the object to be grabbed with the controller and press the grip button.
  • XR with hands: place your hand on the object and perform the pinch gesture.
  • Desktop: touch the object to be grasped with the on-screen controller and press the G (left controller) or H (right controller) keys.
  • CAVE: touch the object to be grabbed with the flystick and press the grip button.

Add a Grab Interaction to a GameObject

To add grab interaction to an object you must:

  1. Configure the Grabbable Object with the necessary components.
  2. Use the XRGrabInteractable events if you want to add logic when interacting with it.

Set up the Grab Interactable object

To make an object grabbable it must have, at least, the following components.

  • XRGrabInteractable: component of Unity's XR Interaction Toolkit package.
  • Rigidbody: XRGrabInteractable depends on this component, if it did not exist it will be added when adding the previous one.
  • Collider: a Collider must be added, in this same GameObject or within its hierarchy.
  • NetworkGrabbable: VIROO Interaction System component, which is used to make the object's grip work for all users in the session.
  • NetworkObject: VIROO Networking System component. NetworkGrabbable depends on it. The Generate Object Id button must be clicked to assign it a unique identifier.
  • NetworkTransform: VIROO Networking system component. Necessary to synchronize the position of this object for the rest of the users.

For more information about XR Grab Interactable go to the XR Interaction Toolkit documentation.

grab-interaction.png

Use XRGrabInteractable events if necessary

At this point you can use XRGrabInteractable events to trigger logic when interacting with the grabbable. VIROO Interaction System ensures that XRGrabInteractable events are propagated over the network to all users. With this, the events you subscribe will be called to all users in the Scene.

If you want to use the VIROO Interaction System Actions, you must use the LocalExecute functions (instead of Execute).

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

grab-interaction-event.png