#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

Advertisements

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

Leave a Reply

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s