Start Building for HoloLens
Apr 13, 2017
The tools needed for this project are:
- Unity 5.5.1
- Visual Studio 2015
- To quickly start developing HoloLens apps you can clone a base Unity3D project from our Git.
The project includes Microsoft's HoloToolkit, a collection of scripts and components intended to accelerate the development of holographic applications targeting Windows Holographic. It includes a handful of assets that act as building blocks and the foundation for HoloLens development, you can always tune up this implementation or make your own using the HoloLens API.
After cloning the base project, open the root cloned folder with Unity.
Find and open the Main scene located on the Assets folder.
The Main scene contains 3 game objects:
HoloLensCamera game object is the main camera of the scene. The HoloLens headset renders the scene using this camera field of view and perspective. This object also represents the three-dimensional position and rotation of the user wearing it. For this reason it is often used to track the wearer's movement and position at any given time.
- This camera renders black color (#00000000) as transparent.
- The recommended minimum rendering distance is 0.85 meters.
- For debugging using the unity player, you can emulate the headset movement using keyboard arrow keys for position and mouse for rotation.
"Managers game object" is a collection of game objects that intend to perform as HoloLens API handlers. For example, you can add the InputManager prefab from the HoloToolkit if you want to capture user input gestures such as pinch, hold, hand track, or even speech recognition.
Another interesting manager is the SpatialMapping manager which is embedded in the SpatialMapping game object, this game object uses HoloLens depth sensors in order to create a collection on three-dimensional objects (meshes) in runtime that represent the physical world objects being mapped by the headset.
CursorWithFeedback is another game object from the HoloToolKit that renders a cursor when the camera directly faces a game object composed by a mesh. A clear example is when a user gazes at a spatial surface and the cursor is placed and rotated over the collided point. HoloToolKit provides a few prefab cursors that mimic the ones used on the HoloLens OS.
The cloned example is ready to build, go to File > Build Settings. Click on Add Open Scenes and it should bring and tick the Main scene in the Scenes in the Build List.
Windows Storeas target platform, Universal 10 as SDK, HoloLens as target device, D3D as UWP build Type, check Unity C# Projects and Development Build.
Build the Unity3D project into a new folder named App.
This will create a Visual Studio solution inside the app folder.
Open Solution, change the targeting device to Remote Machine and type the HoloLens IP address. If this is the first time you deploy an app to HoloLens, you have to follow the Pairing your device instructions.
Change the deployment build to target x86 and switch to release mode.
Congratulations, you have successfully deployed the Hololens Base app. Now you can start playing around with the different Prefabs and Scene examples.
To learn more check out the Microsoft HoloLens tutorials.