Input Bindings
Input Binding Paths
This guide explains how to access HMD data from OpenXR in Unity using the Input System's built-in HMD bindings.
HMD device layout
The OpenXR Plugin provides a device layout for the HMD, which inherits from the <OpenXRHmd>
layout. This layout has four elements: centerEye
, device
, leftEye
, and rightEye
. Each element has four controls: position
, rotation
, velocity
, and angularVelocity
. These controls are exposed in the Unity Input System through the following bindings:
Name | Path | Type | ControlType | InitialStateCheck |
---|---|---|---|---|
Position | <OpenXRHmd>/devicePosition <OpenXRHmd>/centerEyePosition | Value | Vector3 | True |
Rotation | <OpenXRHmd>/deviceRotation | Value | Quaternion | True |
Status | <OpenXRHmd>/trackingState | Value | Integer | True |
Tracked Pose Driver
The Tracked Pose Driver allows objects to mirror the positional and rotation input of any Input Device. To track the HMD position :
- Add a Tracked Pose Driver (Input System) component to the target transform.
- Set the Tracking Type to Rotation And Position.
- For the both the Position and Rotation input set the Input Action binding path to XR HMD.