Reading Time: 2 minutes
Checked with: Unity 2018.3.10f1
The UnityXR CameraRig prefab provides a camera that tracks the HMD rotation and position along with any available XR controllers.
The outcome of this How-To Guide is to learn how to add the UnityXR CameraRig prefab to the scene and configure it for the tracking space type you require.
HMD- A Head Mounted Display is a display device that is worn on the head, usually a VR/AR Headset.
CameraRig- A GameObject that contains a HMD representation and controller representations.
6 degrees of freedom- An object that is real world tracked in the 3 rotational axes and 3 directional axes, also known as room scale tracking.
3 degrees of freedom- An object that is real world tracked in only the 3 rotational axes and no directional axes, also known as stationary tracking.
Expand the VRTK Prefabs Package directory in the Unity Project window until the
Packages -> VRTK Prefabs -> CameraRig -> UnityXRCameraRig directory is visible and select the
UnityXRCameraRig directory so the contents are displayed.
UnityXRCameraRig prefab then drag and drop it into the Hierarchy window.
Then delete the
Main Camera GameObject from the Unity Hierarchy window as the
UnityXRCameraRig contains a Main Camera for the Scene.
UnityXRCameraRig GameObject in the Unity Hierarchy window and change the
Unity XR Configuration component to suit your Tracking Space requirements.
Tracking Space Typeis set to:
Room Scalefor XR devices that support 6 degrees of freedom tracking (the ability to move around your play area).
Stationaryfor XR devices that support 3 degrees of freedom tracking (only the ability to look around but not move within your play area).
Now you have a UnityXR CameraRig in your scene. If you play the Unity scene you will see that the game Main Camera is tracking the XR HMD and if there is a connected left and/or right XR controller then they will be tracking the Left/Right Anchors of the UnityXR CameraRig.