Interaction Basics
Learn the essentials of the Unity XR Interaction Toolkit, covering Interactors, Interactables, and Socket Interactors for precise object placement.
Setting up HMD and controller tracking is the first step in a VR project. However, the essence of the gameplay lies in understanding and implementing Interactions. Therefore, we’ll start learning the Interaction System of the Unity XRI Toolkit in this lesson.
Interaction System
The Interaction System consists of three components:
Interactor: It’s the object that performs the action.
Interactable: It’s the object over which the action is to be performed.
Interaction Manager: It’s the object that relays interaction intent between the Interactor and Interactable.
The diagram below summarizes how these components fit together:
Interaction
An Interaction, in essence, is a change in the state of an object (Interactable) caused by another object (Interactor). Primarily, there are three states defined natively in the XRI Toolkit, which are as follows:
Interaction States
State | Function | Example |
Hover | This signifies that an Interactor has selected this Interactable as a valid Interaction target. | Pointing the controller (Interactor) toward the Interactable, which causes the latter to be highlighted in some sense (e.g., color change) |
Select | This occurs when an Interactor initiates a select action (usually via a button press) that causes the Interactable to switch to the selected state. | Grabbing an object or holding a door knob |
Activate | This occurs when an Interactor initiates the activate action (usually via a button press) on the currently selected Interactable. | Unsheathing/sheathing a lightsaber |
Interactor
The Interactor component is responsible for identifying Interactable objects in the World Space. Therefore, the objects identified by the Interactor are called valid targets (a list of Interactables generated by some priority).
Interactable
The Interactable component allows an ...