Book Image

HoloLens Beginner's Guide

By : Jason M. Odom
Book Image

HoloLens Beginner's Guide

By: Jason M. Odom

Overview of this book

HoloLens revolutionizes the way we work and interact with the virtual world. HoloLens brings you the amazing world of augmented reality and provides an opportunity to explore it like never before. This is the best book for developers who want to start creating interactive and intuitive augmented reality apps for the HoloLens platform. You will start with a walkthrough of the HoloLens hardware before creating your first app. Next you will be introduced to the various HoloLens sensors and find out how to program them efficiently so that they can interact with the real world seamlessly. Moving on, you will learn how to create smart animations and add video overlay that implements real-time tracking and motion-sensing abilities to your HoloLens app. Finally, you will learn how to test your app effectively.
Table of Contents (18 chapters)
Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Dedication
Preface

Filling in the blanks


In this section, we will finally make sure that our network code can understand our object by spawning it with network-friendly code. Instead of turning our skee object on or off based on certain conditions, we will spawn it into the game using the PrefabSpawnManager.

The PrefabSpawnManager class takes a Prefab and converts it into data types that can easily be translated across a network. This makes for a far more efficient use of objects:

To begin, click on that Add Component button shown in the preceding screenshot. Scroll down to New Script, type SyncSpawnSkee in the box, make sure that C Sharp is selected, and click on the Create and Add button.

Double-click on the file you have just created, and when it opens, type this short section of code into the editor:

In the SyncSpawnSkeeBallMachine() method, we first create a SyncSpawnedObject called  spawnedObject. We then get the position to spawn the object. In this case, we are using the actual position stored in the Prefab...