If you work with Beta products you will find funny scenarios, like something working, then not working, then working again. The next Hololens forums thread is a must read if you want to understand the frustration you can get in this scenarios:
VS2017/U5.6 Crash – WinRTScriptingObjectWrapper::InternalAddRef Reference Count cannot be zero (link)
TLTR HoloToolkit current version is not officially supported for the combo Visual Studio 2017 and Unity3D 5.6.
There are features like Tap To Place which are not working fine with VS2017 and Unity3D 5.6. If you implement this, as soon as the Hololens App starts, it will crash and close. Without any clear explanation on what´s happening. It seems to be something related to World Anchors and the way Unity are is working with this, this issue is still alive on GitHub (link).
So, I need Tap To Place, and I decided to implement this myself. I pickup some code from HoloToolkit and some other pieces from Holographic Academy tutorials and I’ve created 2 main classes which fix the problem, and also add some additional value. Here are the main implemented features
- We can perform an initial scan of an environment, based on a time constraint. Also we can continue the scan process if we don’t find a minimum of number of planes for floor or wall
- We can associate one class to an hologram to have the Tap to Place feature
- This process also allow us to validate if we can place the hologram in a vertical (wall) or horizontal (floor) plane
- The validation process also have some visual features like change the color of a box collider from red to green depending if we can or can’t place an object and also cast a shadow with the final location of the hologram
In the next animation we can see a cylinder hologram with the following configuration:
- Green material for the rigid box for valid place
- Red material for the rigid box for invalid place
- No shadows enabled
The complete source code can be downloaded from GitHub (link).
Greetings @ Toronto
- GitHub, HoloToolkit
- GitHub, HoloToolkit Unity
- Hololens Forums, VS2017/U5.6 Crash – WinRTScriptingObjectWrapper::InternalAddRef Reference Count cannot be zero
- El Bruno, How to Import the HoloToolkit Unity
- El Bruno, How to place a Hologram using AirTap and HoloToolkit
- El Bruno, Creating a menu with options with HoloToolkit
- El Bruno, Using voice commands to display a menu with HoloToolkit
- El Bruno, How to create a 3D text always visible using HoloToolkit
- El Bruno, How to create a HUD (3D text always visible without HoloToolkit)
- El Bruno, How to detect hands using HoloToolkit
- El Bruno, Windows 10, Xbox One Controller, Bluetooth and some lessons learned
- El Bruno, How to use Fire Buttons actions with an XBoxOne Controller
- El Bruno, HoloToolkit compiled packages for Unity3D in GitHub
- El Bruno, How to detect AirTap and Click actions using HoloToolkit
- El Bruno, Detect user hand interactions using #HoloToolkit
- El Bruno, Moving and rotating Holograms using an XBoxOne Controller
- El Bruno, Spatial Understanding vs Spatial Mapping, and a tutorial on how to use them
- El Bruno, Spatial Mapping, tutorial to search for simple surfaces, like a 1×1 tile on the floor
Hello! Thank you for this blog post and the sample code, very useful!
Unfortunately I tried to import your project into Unity in order to test it, and it’s not working. 😦
There are 4 “missing prefab” in the scene, and the “Script”, “TextDebugDisplay” and “Player” objects have the references to the correct scripts missing; how can I fix these?
Let me double check the sample files in GitHub. I may forgot to add some files