HoloLens Tutorial – TagAlongs and Billboarding

Last Updated: Apr 22, 2017

Tutorial Accomplishments

  1. Get the Project Better Organized
  2. Create a Spatial Status Billboard that TagsAlong

What’s Next?

The last couple tutorials have focused on getting real time spatial mapping running. The next couple of tutorials will layer spatial understanding on top of spatial mapping to get a better understanding of the environment the user is in. Spatial Understanding will consist of two parts, spatial mapping and finalizing the spatial understanding, which can then trigger the actual application to start. In order to allow the user to finalize the spatial understanding, the application must give the user some feedback on whether or not the spatial map has enough detail for the application to run. This tutorial will focus on creating a place for that user feedback to appear, which will set us up for adding spatial understanding and finalizing it.

 

Get the Project Better Organized

Before we continue this tutorial, lets get the project better organized in Unity. Right now we have built out a scene structure that is completely flat with each object at the root of the Scene. If we continue this way by the end of this tutorial we will have 10-20 gameobjects at the root of the scene which will be difficult to manage.  Create three Empty GameObjects at the root of your scene.  Rename them to “Basics”, “Spatial”, and “Holograms”. Move “Directional Light” and “HoloLensCamera” into the Basics GameObject.  Move “Spatial Mapping” into the Spatial GameObject.  This will cause your Scene to be organized like this:

Create a Spatial Status Billboard that TagsAlong

Now that our project is better organized let’s create the Billboard.  Under Holograms in the Hierarchy create an Empty GameObject and name it “Spatial Status Billboard”.  Under the Spatial Status Billboard add a new 3D Text Gameobject, this is found under 3D Objects.  Rename it to TextDisplay. Set the Text Mesh and Transform properties to match the properties in the image below:

Next create another 3D Text GameObject under Spatial Status Billboard.  Rename it to TextSubDisplay.  Set the Text Mesh and Transform properties to match the properties in the image below:

Now Press play inside the editor.  Move about a meter back and you should see the text we just added, looking something like this:

Both of the 3D Text objects are visible but they are in a fixed position in the world. These text objects should always be visible to the user, in other words we want them to “TagAlong” with the user. Select the Spatial Status Billboard GameObject in the Hierarchy.  In the Inspector click Add Component.   Add the Simple Tagalong component from the HoloToolkit.  Set the Tagalong distance to 1.75 (this brings the text slightly closer to the user) and the position update speed to 10, which causes the text to catch up to the user faster.  Your Settings should look like this:

Press play.  You will notice as you move around the text is trailing after you.  In the editor the text typically trails a bit off screen, on the actual device with the content we will put there, the text will remain on screen. We still have one problem, the text does not always face the user.  To correct this we will use the Billboard component from the HoloToolkit.  Select the TextDisplay GameObject from the Hierarchy.  Click Add Component in the Inspector and add the BillBoard Component.  Set the Pivot Axis to Y. Your TextDisplay GameObject should now look like this:

Do the same for the TextSubDisplay GameObject.  Press Play. The text both tags along and always faces the user!  We now have a good place to display information to the user.

Tutorial Index

  Versions: Unity 2017.1.0p5 | MixedRealityToolkit-Unity v1.2017.1.0Visual Studio 2017 15.3.2
Unity 3D Project Creation How to create a HoloLens project in Unity 3D
Source Control Configure git for HoloLens / Unity work
Spatial Mapping How to spatial map a Room
Object Surface Observer Set up fake spatial map data for the Unity editor
TagAlongs and Billboarding   Tag along instructions to the user to force text on screen
Spatial Understanding Add spatial understanding to get play space detail
Finalizing Spatial Understanding Complete Spatial Understanding and Input Manager
Object Placement and Scaling Find valid locations for holograms in the play space
Hologram Management Manage the holograms you want to place in the world
Cursor and Voice Add a cursor and voice commands
Occlusion Add occlusion with the real world to your scene
Colliders and Rigidbodys Add Colliders and RigidBodys to your holograms

2 thoughts on “HoloLens Tutorial – TagAlongs and Billboarding

  • Posted on April 28, 2019 at 1:00 pm

    these tutorials are better organized and maintained than the official [outdated & broken] microsoft hololens academy ones. thanks for taking the time to put them together

    Reply
    • Posted on April 29, 2019 at 2:57 pm

      Thank you! That was the whole idea when I created them. I’m glad people are still getting good use out of them, as they approach their end of life with MRTK V2!

      Reply

Leave a Reply