Socket Interaction
Unity's XR Socket Interactor 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 Near-Far Interactor, XR Direct Interactor and XR Ray Interactor, 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 XR Grab Interactable 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:
- XR Socket Interactor: XRSocketInteractor is the interactor which performs this kind of interaction. This component is provided by Unity´s XR Interaction Toolkit
- XR Grab Interactable: XRGrabInteractable is the component with which XRSocketInteractor interacts.
- Viroo XR Socket Interactor: this component is in charge of configuring the way XR Grab Interactable interacts with the XR Socket Interactor and also that the interaction events are triggered by networking.
These are the components you need to set up a socket.
- XR Socket Interactor: Unity´s XR Interaction Toolkit component.
- Collider: this GameObject must have one collider.
- Network Object: necessary to identify the GameObject by Networking.
- Viroo XR Socket Interactor: necessary to setup how XR Socket Interactor is interacted and to launch the events through the Network.
XR Socket Interactor
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 XR Socket Interactor to interact with XR 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.
Network Object
For network functions to work properly, interacting components need this component that uniquely identifies them across the network. It's therefore important to ensure that their ObjectId identifier isn't repeated.
Viroo XR Socket Interactor
This VIROO component is necessary to setup how XR Socket Interactor 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 XR 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 XR 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. |