Unity User Manual 5.6 Paper Copy

  

When the user selects a paper sphere, we'll make the sphere fall by turning on gravity using Unity's physics engine. Control your holograms with the Select gesture. We'll start by creating a script than can detect the Select gesture. In the Scripts folder, create a script named GazeGestureManager. This manual is intended for service representatives and technical personnel who maintain, troubleshoot, or repair this equipment. Ordering manuals A paper copy of this manual will be provided upon request. Contact your local GE representative and request the part number on the first page of the manual. Revision Comment A Initial release. Feb 28, 2019  On February 28th the Feedback website will shut down and be redirected to the Unity forums.This will be the primary source of community feedback until we’re able to get a new, more scalable, and dedicated feedback solution in place (more details on that in the coming months). Unity Learn provides award-winning free tutorials, sample projects, and full courses for mastering real-time 3D development skills with Unity Learn to make video games, VR, AR, and more.

-->

Note

The Mixed Reality Academy tutorials were designed with HoloLens (1st gen) and Mixed Reality Immersive Headsets in mind. As such, we feel it is important to leave these tutorials in place for developers who are still looking for guidance in developing for those devices. These tutorials will not be updated with the latest toolsets or interactions being used for HoloLens 2. They will be maintained to continue working on the supported devices. A new series of tutorials has been posted for HoloLens 2.


This tutorial will walk you through a complete project, built in Unity, that demonstrates core Windows Mixed Reality features on HoloLens including gaze, gestures, voice input, spatial sound and spatial mapping. The tutorial will take approximately 1 hour to complete.

Device support

CourseHoloLensImmersive headsets
MR Basics 101E: Complete project with emulator ✔️

Before you start

Prerequisites

  • A Windows 10 PC configured with the correct tools installed.

Project files

  • Download the files required by the project. Requires Unity 2017.2 or later.
    • If you still need Unity 5.6 support, please use this release.
    • If you still need Unity 5.5 support, please use this release.
    • If you still need Unity 5.4 support, please use this release.
  • Un-archive the files to your desktop or other easy to reach location. Keep the folder name as Origami.

Note

If you want to look through the source code before downloading, it's available on GitHub.

Chapter 1 - 'Holo' world

In this chapter, we'll setup our first Unity project and step through the build and deploy process.

Objectives

  • Set up Unity for holographic development.
  • Make a hologram.
  • See a hologram that you made.

Instructions

  • Start Unity.
  • Select Open.
  • Enter location as the Origami folder you previously un-archived.
  • Select Origami and click Select Folder.
  • Save the new scene: File / Save Scene As.
  • Name the scene Origami and press the Save button.

Setup the main camera

  • In the Hierarchy Panel, select Main Camera.
  • In the Inspector set its transform position to 0,0,0.
  • Find the Clear Flags property, and change the dropdown from Skybox to Solid color.
  • Click on the Background field to open a color picker.
  • Set R, G, B, and A to 0.

Setup the scene

  • In the Hierarchy Panel, click on Create and Create Empty.
  • Right-click the new GameObject and select Rename. Rename the GameObject to OrigamiCollection.
  • From the Holograms folder in the Project Panel:
    • Drag Stage into the Hierarchy to be a child of OrigamiCollection.
    • Drag Sphere1 into the Hierarchy to be a child of OrigamiCollection.
    • Drag Sphere2 into the Hierarchy to be a child of OrigamiCollection.
  • Right-click the Directional Light object in the Hierarchy Panel and select Delete.
  • From the Holograms folder, drag Lights into the root of the Hierarchy Panel.
  • In the Hierarchy, select the OrigamiCollection.
  • In the Inspector, set the transform position to 0, -0.5, 2.0.
  • Press the Play button in Unity to preview your holograms.
  • You should see the Origami objects in the preview window.
  • Press Play a second time to stop preview mode.

Export the project from Unity to Visual Studio

  • In Unity select File > Build Settings.
  • Select Windows Store in the Platform list and click Switch Platform.
  • Set SDK to Universal 10 and Build Type to D3D.
  • Check Unity C# Projects.
  • Click Add Open Scenes to add the scene.
  • Click Player Settings....
  • In the Inspector Panel select the Windows Store logo. Then select Publishing Settings.
  • In the Capabilities section, select the Microphone and SpatialPerception capabilities.
  • Back in the Build Settings window, click Build.
  • Create a New Folder named 'App'.
  • Single click the App Folder.
  • Press Select Folder.
  • When Unity is done, a File Explorer window will appear.
  • Open the App folder.
  • Open the Origami Visual Studio Solution.
  • Using the top toolbar in Visual Studio, change the target from Debug to Release and from ARM to X86.
    • Click on the arrow next to the Device button, and select HoloLens Emulator.
    • Click Debug -> Start Without debugging or press Ctrl + F5.
    • After some time the emulator will start with the Origami project. When first launching the emulator, it can take as long as 15 minutes for the emulator to start up. Once it starts, do not close it.

Chapter 2 - Gaze

In this chapter, we are going to introduce the first of three ways of interacting with your holograms -- gaze.

Objectives

  • Visualize your gaze using a world-locked cursor.

Instructions

  • Go back to your Unity project, and close the Build Settings window if it's still open.
  • Select the Holograms folder in the Project panel.
  • Drag the Cursor object into the Hierarchy panel at the root level.
  • Double-click on the Cursor object to take a closer look at it.
  • Right-click on the Scripts folder in the Project panel.
  • Click the Create sub-menu.
  • Select C# Script.
  • Name the script WorldCursor. Note: The name is case-sensitive. You do not need to add the .cs extension.
  • Select the Cursor object in the Hierarchy panel.
  • Drag and drop the WorldCursor script into the Inspector panel.
  • Double-click the WorldCursor script to open it in Visual Studio.
  • Copy and paste this code into WorldCursor.cs and Save All.
  • Rebuild the app from File > Build Settings.
  • Return to the Visual Studio solution previously used to deploy to the emulator.
  • Select 'Reload All' when prompted.
  • Click Debug -> Start Without debugging or press Ctrl + F5.
  • Use the Xbox controller to look around the scene. Notice how the cursor interacts with the shape of objects.

Chapter 3 - Gestures

In this chapter, we'll add support for gestures. When the user selects a paper sphere, we'll make the sphere fall by turning on gravity using Unity's physics engine.

Paper

Objectives

  • Control your holograms with the Select gesture.

Instructions

We'll start by creating a script than can detect the Select gesture.

  • In the Scripts folder, create a script named GazeGestureManager.
  • Drag the GazeGestureManager script onto the OrigamiCollection object in the Hierarchy.
  • Open the GazeGestureManager script in Visual Studio and add the following code:
  • Create another script in the Scripts folder, this time named SphereCommands.
  • Expand the OrigamiCollection object in the Hierarchy view.
  • Drag the SphereCommands script onto the Sphere1 object in the Hierarchy panel.
  • Drag the SphereCommands script onto the Sphere2 object in the Hierarchy panel.
  • Open the script in Visual Studio for editing, and replace the default code with this:
  • Export, build and deploy the app to the HoloLens emulator.
  • Look around the scene, and center on one of the spheres.
  • Press the A button on the Xbox controller or press the Spacebar to simulate the Select gesture.

Chapter 4 - Voice

In this chapter, we'll add support for two voice commands: 'Reset world' to returns the dropped spheres to their original location, and 'Drop sphere' to make the sphere fall.

Objectives

  • Add voice commands that always listen in the background.
  • Create a hologram that reacts to a voice command.

Instructions

  • In the Scripts folder, create a script named SpeechManager.
  • Drag the SpeechManager script onto the OrigamiCollection object in the Hierarchy
  • Open the SpeechManager script in Visual Studio.
  • Copy and paste this code into SpeechManager.cs and Save All:
  • Open the SphereCommands script in Visual Studio.
  • Update the script to read as follows:
  • Export, build and deploy the app to the HoloLens emulator.
  • The emulator will support your PC's microphone and respond to your voice: adjust the view so the cursor is on one of the spheres, and say 'Drop Sphere'.
  • Say 'Reset World' to bring them back to their initial positions.

Chapter 5 - Spatial sound

In this chapter, we'll add music to the app, and then trigger sound effects on certain actions. We'll be using spatial sound to give sounds a specific location in 3D space.

Objectives

  • Hear holograms in your world.

Instructions

  • In the Unity select from the top menu Edit > Project Settings > Audio
  • Find the Spatializer Plugin setting and select MS HRTF Spatializer.
  • From the Holograms folder, drag the Ambience object onto the OrigamiCollection object in the Hierarchy Panel.
  • Select OrigamiCollection and find the Audio Source component. Change these properties:
    • Check the Spatialize property.
    • Check the Play On Awake.
    • Change Spatial Blend to 3D by dragging the slider all the way to the right.
    • Check the Loop property.
    • Expand 3D Sound Settings, and enter 0.1 for Doppler Level.
    • Set Volume Rolloff to Logarithmic Rolloff.
    • Set Max Distance to 20.
  • In the Scripts folder, create a script named SphereSounds.
  • Drag SphereSounds to the Sphere1 and Sphere2 objects in the Hierarchy.
  • Open SphereSounds in Visual Studio, update the following code and Save All.
  • Save the script, and return to Unity.
  • Export, build and deploy the app to the HoloLens emulator.
  • Wear headphones to get the full effect, and move closer and further from the Stage to hear the sounds change.

Chapter 6 - Spatial mapping

Now we are going to use spatial mapping to place the game board on a real object in the real world.

Objectives

  • Bring your real world into the virtual world.
  • Place your holograms where they matter most to you.

Instructions

  • Click on the Holograms folder in the Project panel.
  • Drag the Spatial Mapping asset into the root of the Hierarchy.
  • Click on the Spatial Mapping object in the Hierarchy.
  • In the Inspector panel, change the following properties:
    • Check the Draw Visual Meshes box.
    • Locate Draw Material and click the circle on the right. Type 'wireframe' into the search field at the top. Click on the result and then close the window.
  • Export, build and deploy the app to the HoloLens emulator.
  • When the app runs, a mesh of a previously scanned real-world living room will be rendered in wireframe.
  • Watch how a rolling sphere will fall off the stage, and onto the floor!

Now we'll show you how to move the OrigamiCollection to a new location:

  • In the Scripts folder, create a script named TapToPlaceParent.
  • In the Hierarchy, expand the OrigamiCollection and select the Stage object.
  • Drag the TapToPlaceParent script onto the Stage object.
  • Open the TapToPlaceParent script in Visual Studio, and update it to be the following:
  • Export, build and deploy the app.
  • Now you should now be able to place the game in a specific location by gazing at it, using the Select gesture (A or Spacebar) and then moving to a new location, and using the Select gesture again.

The end

And that's the end of this tutorial!

You learned:

  • How to create a holographic app in Unity.
  • How to make use of gaze, gesture, voice, sounds, and spatial mapping.
  • How to build and deploy an app using Visual Studio.

Unity User Manual 5.6 Paper Copy Pdf

You are now ready to start creating your own holographic apps!

See also

If you’ve ever wanted to add real world maps to your Unity game or application, you’re in luck. This week, I tried out the Mapbox Unity plugin and have to report that it’s extremely easy to use and pretty powerful. If you want to get real world maps like PokemonGO, or even generate a voxel world from real terrain, mapbox makes it quick and painless to accomplish. These Unity3D maps can be generated dynamically at runtime or if you have a specific location you can pre-build them and include them with your app or game.

Getting the Unity3d maps SDK (MapBox)

You can download the mapbox Unity SDK here: https://www.mapbox.com/unity/
It comes as an .assetpackage file that you import into your project.

Account Setup

Before you can use mapbox in your application, you need an account and an API key.
Create an account on the mapbox site.

Visit your API Tokens page and copy your api token: https://www.mapbox.com/studio/account/tokens/

Open the Mapboxwindow.

Enter your Access Token

Unity User Manual 5.6 Paper Copy Sheet

If it’s valid, you should see the “TokenValid” notification in the window.

Examples

The first thing I’d recommend you try is load up the various example scenes that come with the package.
These examples show a good sampling of the things you can do with the mapbox plugin.

Start with the Slippy demo, it’s likely the most applicable for your projects.
It shows how to select an area and start scrolling along, loading in new tiles as they’re needed (much like you’d do if you were tracking a persons real world position).

The mesh here is 3d, you can also run on it, fly over it, or anything else you’d do with a 3d terrain

You can adjust the starting location and zoom range with the MapController gameobject in the scene.

What kind of maps can I have?

If you take another look at the MapController, you’ll see there’s a Map Visualization field.

The Map visualization controls exactly what it says, the visuals of your map. You can customize it or build your own from scratch (I’d recommend customizing a few first).

They’ve also bundled a variety of visualizations into the plugin, if you search and replace (or try out other demo scenes), you can see how some of these look.

For example, here I’ve swapped in the PoiDemoVisualization and moved our starting point to London

Voxel Maps

Unity User Manual 5.6 Paper Copy Download

Or.. maybe you want a minecraft style voxel representation of your area..

The VoxelWorld scene shows exactly how to set this up.

Pre-building a map

One thing I needed to do and you may as well is pre-generate a map for a specific area.

If your application or game only needs a certain geographic area, maybe a map of some specific city, or a big landmark like the pyramids.. you can build it and bundle it in with very little work.

The MapController class that ships with the plugin is meant to be a demo/starting point, but with a little extension you can change it to be an editor time generator instead of runtime.

The quick and dirty way to do this is just edit the MapController class and move the map generation / initialization to a context menu.

Change this..

To this..

And you’ll have a context menu like this that you can use before pressing play.

It’s important to note that if you do this, you WILLbreak the demos. So if you’re even a little comfortable with c#, you’re probably better off copying the MapController class and making your own modified version of it. Or if you’re very comfortable with c#, dig in and build something awesome.

Range

The last thing I want to cover is the Range field. This tells Mapbox how many tiles away from the Lat/Lng you want to generate in each direction (N, E, S, W). It defaults to 0, but you can adjust it to the values that feel right for your specific application.

Performance Notes

While I was trying out this plugin, I wanted to know how it would fare for performance. With some of the demos I quickly realized there was a big variance on the vertex count depending on some options.

The biggest performance hit I came across was with generating roads. With roads on, in a smaller metropolitan area, my vertex count went from around 500,000 to 20,000,000.
This could be a bug, or it could be me using the SDK wrong, I’m not sure (though I’m going to ask the developers). But if you need to keep your counts down, I’d recommend disabling road generation in your visualiaztion settings (or using one of the predefined ones that doesn’t generate road meshes).

Pricing

I haven’t had a need to pay for Mapbox yet because my usage is pretty small. The free plan covers up to 50,000 users a month on mobile, and after that the price jumps up quick to $499/mo.

But if you have more than 50k users a month in your app or game and collect any revenue at all, the cost should be nominal.

The big limit on the free version seems more than generous and is probably the tier most people are in.

if you pre-generate the maps, you’re never calling the sdk and wouldn’t hit this either, but again that’s only valid for uses where you don’t need the whole world, just a tiny area.

Conclusions

I really love this Mapbox SDK and the fact that it’s free to use for most projects. It’s easy to get setup with and customize to your hearts desire. I plan to keep using it going forward and dig in deeper to discover all the power inside.