Controller Tracked Pose Driver
Unity Input System - Tracked Pose Driver
The Tracked Pose Driver component is provided by Unity and allows objects to mirror the positional and rotation input of any input device. Perform the following steps to track the position of the controller:
- Add a Tracked Pose Driver (Input System) component to the target transform.
- Set the tracking type to Rotation And Position.
- In the Position Input section, select the + icon, and set the path to
MagicLeapController/devicePosition
orXRController/devicePosition
. - Next in the Rotation Input section, select the + icon, and set the path to
MagicLeapController/deviceRotation
.
Control Binding Paths
Unity's Input System can look up Controls using paths. Bindings on Input Actions rely on this feature to identify the Control(s) they read input from. However, you can also use them for lookup directly on Controls and Devices, or to let the Input System search for Controls among all devices using InputSystem.FindControls
.
See Unity's Control Path documentation to learn more.
Action | Binding Path |
---|---|
Bumper | MagicLeapController/gripbutton |
Is Tracked | MagicLeapController/isTracked |
Menu | MagicLeapController/menubutton |
Position | MagicLeapController/devicePosition |
Rotation | MagicLeapController/deviceRotation |
Touchpad | MagicLeapController/primary2daxis MagicLeapController/mlcontrollertouchforce |
Touchpad (2nd Finger Touch) | N/A |
Trigger | MagicLeapController/TriggerAxis |
XR - XR Controller
Alternatively, you can use either the action based or the device based XRController components.
Device Based
- Add a XR Controller (Device-based) component to the target transform.
- Enable Input Tracking.
- Next, enable Input Actions.
- Finally, set the Controller Node to Game Controller.
Action Based
- Add a XR Controller (Action-based) component to the target transform.
- Enable Input Tracking
- Under the Position Action, select the + icon, and bind the position to devicePosition [XR Controller]
- Finally, in the Position Action, select the + icon, and bind the rotation to deviceRotation [XR Controller]