#Hololens – How to use clases TapToPlace and InitialScanManager

Hi !

Yesterday I wrote about a custom solution I made to have Tap to Place feature in an Hololens App. The main set of features was

  • 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

The “InitialScanManager.cs” is the one I use to perform the initial environment scan. I usually add this class to an Empty Game Object. The main properties to use are this ones:

  • Limit Scanning by Time and Scan Time, definen how the scan process will be performed. If we set a Scan Time value of N, and check the Limit Scan time, the app will scan the environment for N seconds and then will stop the scan process
  • Minimum Floor and Minimum Wall defines the minimum amount of frames to be searched in the floor and the wall
  • Player, this is optional for the main hologram. When the scan process start it will be hide and when the scan process ends the player will be show again
  • DebugTextPlayer, optional, a TextMesh used for debug actions

Clipboard02.png

The class “TapToPlacePlayer.cs” is the one we must associate to the element where we want this feature. The main properties are

  • Placeable Bounds and Non Placeable Bounds Materials are materials used when we start the “place mode”. I create a collider with this materials and the class change the materials based on if we can place or not the hologram at the selected position
  • Placeable Shadow and Non Placeable Shadow Materials are materials used to display the final position to be placed for the hologram
  • Display Shadow defines if we want to show (or not) the final position of the hologram
  • Placement Surface defines the positioning mode Horizontal or Vertical. I mean Floor or Wall
  • DebugTextPlayer, optional, a TextMesh used for debug actions

Clipboard04.png

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

Greetings @ Toronto

El Bruno

References

El Bruno, my posts

Advertisements

2 thoughts on “#Hololens – How to use clases TapToPlace and InitialScanManager

  1. Hi!
    Excellent article! But for some reason I can’t open project from repo neither in 5.6.0f3 nor in 5.6.1f1 version of Unity. (Most objects and scripts are missing in scene).

    Like

    1. Hi Pavel
      I’ll double check the repo, maybe I forget to upload something.
      However, the official Holotoolkit repository i always up to date 😀
      I’ll update the post and the blog later
      regards
      -Bruno

      Like

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