Table of Contents

Socket Interaction

Unity's XRSocketInteractor is a component within the XR Interaction Toolkit that allows you to create virtual sockets in your VR experience. These sockets act as designated attachment points for interactable objects.

Unlike XRDirectInteractor and XRRayInteractor, which are typically attached to controllers, the XRSocketInteractor exists within the virtual world itself. It doesn't directly grab objects but instead acts as a receptacle for them.

When an interactable object (an object with the XRGrabInteractable component) gets close enough to the socket, it snaps into place, aligning itself with the socket's transform (position and rotation). This creates a realistic feeling of inserting or attaching objects.

The Socket interaction consists of:

  • Socket Interactor: XRSocketInteractor is the interactor which performs this kind of interaction. This component is provided by Unity´s XR Interaction Toolkit
  • Grab Interactable: XRGrabInteractable is the component with which XRSocketInteractor interacts.
  • Viroo XR Socket Interactor: this component is in charge of configuring the way XRGrabInteractable interacts with the XRSocketInteractor and also that the interaction events are triggered by networking.

These are the components you need to set up a socket.

  • XRSocketInteractor: Unity´s XR Interaction Toolkit component.
  • Collider: this GameObject must have one collider.
  • NetworkObject: necessary to identify the GameObject by Networking.
  • VirooXRSocketInteractor: necessary to setup how XRSocketInteractor is interacted and to launch the events through the Network.

XRSocketInteractor

This is a Unity´s XR Interaction Toolkit component which allows you to create virtual sockets in your VR experience. These sockets act as designated attachment points for interactable objects. For more information please refer to the official documentation here

Collider

For Socket Interactor to interact with Grab Interactable, there needs to be at least one collider, which has to be at the same level as the component. The collider MUST 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.

VirooXRSocketInteractor

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

Field Description
Send Network Events If this box is checked the events triggered by the Socket Interactor (HoverEnter, Select...) will be networked, otherwise the events will be triggered only locally.
Tag Filters If you want the interactor to interact only with specific Grab Interactables, you can define a tag for it. By defining this tag the socket can only be used by interactors that have the same TagFilter defined.
Disable Hover When Socket Is In Use This checkbox allows you to disable the visual feedback of the socket when approaching another interactor when the socket is already in use.

viroo-socket-interactor.png