VR Input System
The VR input system allows managing user input from VR controllers, head-mounted displays (HMDs), base stations, and trackers. It supports a wide range of VR devices, enabling you to utilize several devices from various vendors and process input from them.
The InputVRDevice class provides access to properties and settings common for all VR devices (for example, a device name).
VR Controllers#
Controllers serve as a primary interface for VR input. There are three types of VR controllers: left-hand, right-hand controllers, and a treadmill. You can get the controller's type and check whether it is a hand controller by using the corresponding methods of the InputVRController class.
The VR input system supports a range of controller models compatible with OpenVR, Varjo, and Oculus devices. In this article, we will consider the following models of controllers as examples:
- HTC Vive (compatible with OpenVR and Varjo devices)
- Oculus Touch (compatible only with Oculus HMDs and works via OpenVR)
- Valve Knuckles (compatible with OpenVR and Varjo devices)
UNIGINE API provides access to the VR controller inputs — axes and buttons.
- Buttons are mapped to the controller's buttons that can be pressed, touched, or released.
- Axes detect 1-dimensional movement of the control and have more complex behavior.
Depending on the type of the VR controller, the number of axes differs. UNIGINE supports up to 4 axes. But usually, a controller has 3.
In UNIGINE, an axis can be mapped to a control of one of the following types (also referred to as an axis type): trackpad, joystick, or trigger. Each axis type has a different number of reserved axes. For example, combining two axes of a joystick or trackpad allows tracking of 2-dimensional movement along the X and Y axes.
You cannot know in advance which type of controller is connected, so UNIGINE API allows you to identify the number of supported axes and check their types.
OpenVR Controllers#
This chapter showcases examples of inputs on different types of OpenVR-supported controllers — HTC Vive, Oculus Touch, and Valve Knuckles controllers — and provides information on how these inputs are mapped to the buttons and axes within the UNIGINE input system.
HTC Vive Controller Inputs#
Button/ Axis |
Description | Interaction Type | UNIGINE Button/ Axis |
UNIGINE Axis Number | Axis Range |
---|---|---|---|---|---|
1 | Menu Button | Press |
|
||
2 | Trackpad | Press / Touch |
|
||
2 | Trackpad | Horizontal / Vertical Movement |
|
[-1;1]
|
|
3 | System button | Press |
|
||
7 | Trigger | Press / Touch |
|
||
7 | Trigger | Squeeze | 2 for the Trigger axis | [0;1] | |
8 | Grip button | Press |
|
Oculus Touch Controller Inputs#
Button/ Axis |
Interaction Type | UNIGINE Button/ Axis |
UNIGINE Axis Number | Axis Range |
---|---|---|---|---|
|
Press |
|
||
|
Press |
|
||
|
Press / Touch |
|
||
|
Horizontal / Vertical Movement |
|
[-1;1]
|
|
|
Press / Touch |
|
||
|
Squeeze | 2 for the Trigger axis | [0;1] | |
|
Squeeze |
|
Valve Knuckles Controller Inputs#
Button/ Axis |
Interaction Type | UNIGINE Button/ Axis |
UNIGINE Axis Number | Axis Range |
---|---|---|---|---|
A Button | Press |
|
||
B Button | Press |
|
||
System Button | Press |
|
||
Trigger | Press / Touch |
|
||
Trigger | Squeeze | 2 for the Trigger axis | [0;1] | |
Track Button (Trackpad) | Press / Touch |
|
||
Track Button (Trackpad) | Horizontal / Vertical Movement |
|
[-1;1]
|
|
Thumbstick | Press / Touch |
|
||
Thumbstick | Horizontal / Vertical Movement |
|
[-1;1]
|
|
Grip | Press / Touch |
|
Head-Mounted Displays#
The VR system allows you to process input from head-mounted displays (HMDs) via the InputVRHead class.
Base Stations#
A VR base station helps the HMD and controllers to track their exact positions, enhancing the immersion of room-scale virtual reality experience.
The InputVRDevice and InpitVRBaseStation classes is used to handle base station input.
VR Trackers#
A VR tracker allows embedding real-world objects into the VR environment. You can attach it to a real thing that needs to be tracked. In Mixed Reality, you can install the VR tracker on a camera or player to track its position in the virtual world.
The InputVRDevice and InpitVRTracker classes is used to manage tracker input.