A visible canvas

Here, we will add a panel object to the Canvas to make the whole thing visible to the user instead of a few floating buttons.

Let's remove the Vertical Layout Group from the Canvas object by performing the following:

  1. Select the Canvas in the Hierarchy view.
  2. In Inspector, delete the Vertical Layout Group component, as follows:
  1. Click on the gear in the upper-right corner to get to this menu.
  2. Right-click on Canvas in the Hierarchy view, slide the mouse pointer over UI, and select Panel from the menu:
  1. Select the three button objects in the Hierarchy view, drag them to the Panel object, and release them:
  1. Select the Panel object and click Add Component; select Layout and again add a Vertical Layout. The setting should match the following screenshot:
Setting for the Panel Verticle Layout Group
  1. Select the Canvas and look at the Rect Transform. Change the setting to match this screenshot:
Settings for the Canvas Rect Transform

This is how our canvas should look on completing these steps:

With the visual changes accomplished to work with HoloLens, now it is time to make the technical changes. The canvas has something called a Render Mode. Its default setting is Screen Space-Overlay, which lays the canvas on top of the screen. We need to change that option to World Space. This allows the menu to move around in 3D space.

Now, we will need to add a couple of components from the HoloToolkit:

  1. With canvas still selected, click on the Add Component button, then on Scripts, on  HoloToolKit.Unity, and finally select Tagalong.
  2. Repeat everything in the preceding step, instead adding Billboard.
  3. In the Tagalong setting, change the Tagalong distance to 22:
    • Tagalong: It's a class that keeps the selected object within view of the user without it locking to their head
    • Billboard: This keeps the object facing the user at all times

Now, we need to select the EventSystem and click on Add Component and type Holo in the search field. Select the HoloLens Input Module; this will allow the HoloLens system to interact with the UI elements.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.178.157