Building for Windows Immersive MR
Microsoft's 3D media Mixed Reality strategy is to support the spectrum of devices and applications from virtual reality to augmented reality. This book and our projects are about VR. At the other end is the Microsoft HoloLens wearable AR device. The MixedRealityToolkit-Unity package that we will use includes support for both immersive MR headsets and HoloLens.
To allow your app to use a Windows immersive Mixed Reality (IMR) headset, you will use the Window Mixed Reality SDK, as follows:
- Configure your Unity Build Settings to target the Universal Windows Platform platform.
- In Player Settings, under XR Settings, set Virtual Reality Enabled
- Ensure Windows Mixed Reality is at the top of the Virtual Reality SDKs list.
- Download and install the Mixed Reality Toolkit Unity, as instructed previously.
- We also recommend you install its sister examples unity package from the same location.
Now we will add the MixedRealityCamera rig to the MeMyselfEye object in our scene:
- Look in your Project window; under the Assets folder, you should have a folder named HoloToolkit (or MixedRealityToolkit).
- Within that is a subfolder called Prefabs. Drag the prefab named MixedRealityCameraParent from the Assets/HoloToolkit/Prefabs/ folder into your Hierarchy. Place it as a child object of MeMyselfEye.
- If necessary, reset its Transform to Position (0, 0, 0).
- Disable the Main Camera object, also under MeMyselfEye. You can disable objects by unchecking the enable checkbox in the top-left of its Inspector window. Alternatively, you can just delete the Main Camera object.
- Save the prefab by selecting MeMyselfEye in Hierarchy, then press its Apply button in the Inspector.
Note that the MixedRealityCameraParent rig y position should be set to 0 as it will use the real-life height of the player to set the camera height in real time.
To test it out, make sure that the VR device is properly connected and turned on. You should have the MR Portal app opened in the Windows desktop. Click on the game Play button at the top-center of the Unity Editor. Put on the headset, and it should be awesome! Within VR, you can look all around—left, right, up, down, and behind you. You can lean over and lean in. Using the hand controller's thumb pad, you can make Ethan walk, run, and jump just like we did earlier.