#Hololens – Alternative fix to the TapToPlace and WorldAnchor issue (until official #HoloToolkit release)

Hi !

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

2017 04 26 Holo TapToPlace with Validation 01

The complete source code can be downloaded from GitHub (link).

Greetings @ Toronto

El Bruno

References

20 comments

  1. 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?

    Like

Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: