mixed-reality

MRTK

Follow this step-by-step tutorial to add and automatically configure Mixed Reality Toolkit in your Unity project. It’s also possible to work directly with the MixedRealityPlayspace class from MRTK for Unity and set the Target Scale to World:

MRTK settings window

MRTK should handle the position of the playspace and camera automatically, but it’s good to double check:

MRTK playspace

  1. From the Hierarchy panel, expand the MixedRealityPlayspace GameObject and find the Main Camera child object
  2. In the Inspector panel, find the Transform component and change the Position to (X: 0, Y: 0, Z: 0)

XR SDK

Set your tracking origin mode on the XRInputSubsystem. After obtaining the subsystem, call TrySetTrackingOriginMode:

xrInputSubsystem.TrySetTrackingOriginMode(TrackingOriginModeFlags.Device);
xrInputSubsystem.TrySetTrackingOriginMode(TrackingOriginModeFlags.Unbounded); // Recommendation for OpenXR

You can use ARSession for HoloLens applications, which works better with anchors and ARKit/ARCore.

AR session in hierarchy

[!IMPORTANT] AR Session and related features need AR Foundation installed.

It’s also possible to apply the camera changes manually without using ARSession:

  1. Select Main Camera in the Hierarchy panel
  2. In the Inspector panel, find the Transform component and change the Position to (X: 0, Y: 0, Z: 0)

    Camera in the Inspector pane in Unity
    Camera in the Inspector pane in Unity

  3. Add a TrackedPoseDriver to the Main Camera

Legacy WSA

  1. Select Main Camera in the Hierarchy panel
  2. In the Inspector panel, find the Transform component and change the Position to (X: 0, Y: 0, Z: 0)

    Camera in the Inspector pane in Unity
    Camera in the Inspector pane in Unity

  3. Go to Other Settings section of the Windows Store Player Settings
  4. Choose Windows Mixed Reality as the device, which may be listed as Windows Holographic in older versions of Unity
  5. Select Virtual Reality Supported

Since the Main Camera object is automatically tagged as the camera, Unity powers all movement and translation.

[!NOTE] These settings need to be applied to the Camera in each scene of your app.

By default, when you create a new scene in Unity, it will contain a Main Camera GameObject in the Hierarchy which includes the Camera component, but may not have the settings properly applied.