A Gaze Interaction System for VR
Implementation of a Gaze Interaction system for Unity Virtual Reality projects.
In this project, I share with you a Gaze Interaction system for Unity Virtual Reality (VR) projects.
Gaze allows the user to interact with the environment by looking at certain objects. It was a common practice when using mobile VR, due to the lack of a controller.
But, as soon as virtual reality headsets with controllers entered the market, gaze is not used as much. Still, there are certain contexts where it’s still useful. It provides an easier interaction for users not used to virtual reality and for the ones that are not able to use the controllers.
Gaze Interaction System
I based my system on the same approach used in the Unity XR Interaction Toolkit.
So, I have one GazeInteractor that communicates with GazeInteractables scattered throughout the environment. The Interactor is a child of the camera that sends raycasts looking for Interactables. These in turn, when interacted with, invoke events that we can connect to other objects.
Setup
Add a GazeInteractor as a child of the main camera;
Add GazeInteractables and connect the events to trigger the desired behaviors.
The basic setup is quite simple. But, you have many options in each component to configure it even further. For a more detailed explanation please check this video.
And if you want to include it in your project, download the package from the GitHub repository or from the Unity Asset Store.
All feedback and contributions are more than welcome.