Building an AR Game With Hololens, Part 3: Common Unity and Hololens Terms
Before getting started with development, these are the common Unity and Hololens terms you need to know.
Join the DZone community and get the full member experience.Join For Free
Microsoft’s Hololens is a truly amazing platform. Although out of the hands of the average consumer and more designed for the enterprise (as recently enforced by MS), it still demonstrates what can be done in the AR space.
In this series, we will design a very rudimentary game using the main aspects of Hololens v1 to provide a good, in-depth understanding of how to use this piece of hardware. Please note: This is not a game development tutorial, and that is not the purpose of this tutorial series. However, since Hololens development uses Unity, and now Epic, it will be necessary at times to discuss those relevant concepts.
You may also like: MS Hololens and How to Get Started
The terms and definitions that I provide are my own and fairly basic. I just want the reader to understand what the point and purpose of these terms are, as they are often used frequently in this series.
So, without much more to say, let’s dive in. Please note that these terms are not being given in any specific order.
What is a component? A component is anything that you can attach to a game object that will enable the object to now perform some other action or respond in another way. Many of the things we discuss in this series are add-on components.
In the image of our model, there are a number of elements that need to be pointed out.
What is a collider? A collider is an area around an object. The collider is what tells your program if the model is hit by anything, and if so, you can query it to find out what it is and what should be done. This is typically called a collision. In the model, we have "capsule collider." If one is not included when you import your model, then you should add one by doing the following:
- Click "Add Component"
- Find Capsule Collider by typing in capsule
- Select it and it should be added to your model.
- Make sure that you set so that it covers your model
It is important to understand that in a 3D world, everything has a collider and your objects, as well as you, will be interacting with the environment around it. There are many different elements to colliders and collisions and many people have written about them. For the sake of your learning what they are, this should be a good basic introduction.
Every game has animation. This is the act of the game model actually looking like it is walking, turning its head, firing at you, dying, or any other actions. These are pre-programmed and stored for later use in most games. In our game, we currently only have four animations: idle, walking, attack, and dying. Pretty basic and standard. In Unity, these are controlled via an animation controller. The animation controller is a part of the site that controls the animation from the moment; it is brought into the game. It can be conditional to do certain things that are hit upon by your program.
In order to access the animation in Unity, you will need to select the Animator tab at the top of the screen. This brings you into the area where you can layout the animations. Also, in order for this to work on your model, you will need to add an Animator element to your model if one isn’t there already.
Sound and Voice Control
This goes without saying that voice controls and sound effects are critical, and we will need to add what is called spatial sound to give the 3D space impact.
As you can see from the example in our game, speech is, in fact, handled by the HoloToolkit modules. You add these modules like you would add any other by clicking on "Add Component" and finding the components that you wish to add. In our example, I have set up three keywords in Speech Input Source, and then in the Speech Input Handler script, this is where I assign each word for a function to perform. Check out the image below to see what adding a component should look like:
Stay tuned for our next installment where we look at instantiation. To catch up on previous installments, check out the links below:
Opinions expressed by DZone contributors are their own.