Hi !
After a couple of posts on HoloToolkit, I’ll share the basic steps to use Spatial Mapping in a Unity 3D project. I’ll do this as a memory backup, since always forget something when I’m creating a project.
- Create a project 3D in Unity3D
- Clone HoloToolkit Unity and copy it to the [Assets] folder in our project
- Save the Scene. I strongly suggest to create a folder named [Scenes] inside the folder [Assets] folder of our project, and save here the scene
- Unity will process these changes, this usually take a minute
- At the root of the project in the Hierarchy panel, delete Main Camera and Directional Light
- In the Projects panel search Main Camera and add it to the root of the Hierarchy. Main Camera is in [Assets / HoloToolkit / Utilities / Prefabs]
- In Hierarchy, create an Empty Object and rename it as [Managers]
- In the Projects panel search Cursor and add it within the element as [Managers]. Cursor is in [Assets / HoloToolkit / Utilities / Prefabs]
- Select the [Managers] element in the Hierarchy and in the Inspector panel, press [Add Component]. Type and select [Gaze Manager] in the search and add it
- In the properties of [Gaze Manager] open the combo of [Raycast Layer Mask] and deselect [TransparentFX]
Note: Looking at the source code of [CursorManager.cs] I realized that it also uses [GazeManager], and it is necessary to add it to the project. This took me like crazy a couple of days until I gave with the solution.
- In this moment already have a project that us shows the Gaze in them elements of the environment where we use the Hololens. Is time of adding Spatial Mapping.
- In the panel Projects search SpatialMapping and add it to the root of Hierarchy. SpatialMapping is in [Assets / HoloToolkit / SpatialMapping / Prefabs]
- Now is time of configure the project to be “Hololens capable”
- This it explained in the first tutorial of the Hololens Academy in the section [Export the project from Unity to Visual Studio]
The following video demonstrates the functionality of Spatial Mapping included in the HoloToolkit Unity. I’ve also added the option to enable it or disable it making an AirTap on a cube we see in the environment in front of us.
And ready, this my personal memory reminder !
Greetings @ Toronto
El Bruno
References
- GitHub, HoloToolkit
- GitHub, HoloToolkit Unity
- El Bruno, HoloToolkit amazing set of assets to create #Unity3D apps for Hololens
- El Bruno, HoloToolkit, Scenes automatic configuration, cool Build options and more
- Hololens Academy, Holograms 101