In order for your unity camera to track with head pose, it needs to have the Tracked Pose Driver component with the following settings. Depending on your app setup, you can either add this component to the main camera yourself, or get it through prefabs like the XRRig (from the XR Interaction Toolkit) or the "Main Camera" (from our SDK package).
Unity Input System - 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.
XR - Tracked Pose Driver
The Tracked Pose Driver component has the same functionality as the Tracked Pose Driver (Input System) component. However, instead of binding to an Input Device, the XR version is bound to an XR Device. To mirror the HMD's positional and rotational input do the following :
- Add a Tracked Pose Driver component to the target transform.
- Set the device to Generic XR Device.
- Set the pose source as Center Eye - HMD Reference
- Finally, set the Tracking Type to Rotation And Position.
- Porting Guide
- Learn how to access the Magic Leap's Head Tracking state and mapping events.
MLHeadTracking.TryGetMapEvents(headDevice, out MLHeadTracking.MapEvents mapEvents);
- API to retrieve the Head Tracking Map Events.
MLHeadTracking.TryGetState(headDevice, out MLHeadTracking.State state);
- API to retrieve the Head Tracking State Events.