I am learning how to develop Hololens now, met lots of challenging, I am going to share some thinking of how to use Holotoolkit
1)
What is Holotoolkit?
Of course you can google it, but for me, using some very simple words to introduce Holotoolkit: it is just a set of codes made by Microsoft to help Hololen developer quickly developing their application
2)
Why would I write this blog?
Holotoolkit is a great set of helping class, but to understand it, not that easy. There are lots of videos or articles from internet teaching you how to use Holotoolkit, place this model in, place that model in, and everything works.
But how these model works? why these model works? What cause these model works together so well?
NO ANY ARTICLE INTRODUCING ANYTHING
So I want to write something about what is happening under the hook of Holotoolkit, that's how this blog is coming out
OK, let's begin:
To understanding how holotoolkit works, we have to first understand how Unity codes works, if you don't have basic knowledge of Unity and C# coding, I suggest you learning some basic first.
Holotoolkit or Hololens codes are Unity codes no matter how complex they are, if you create a scene and put some models like this:
From the hierarchy, you can see there are 8 GameObjects listed on the top level, when game started running, something like this will happen(I use C# as the language to simulate what happene at the very beginning)
{
Task.Factory.StartNew(() => new DirectionalLight());
Task.Factory.StartNew(() => new HoloLensCamera());
Task.Factory.StartNew(() => new SpatialMapping());
......
Task.Factory.StartNew(() => new Sphere());
}
all these gameObjects will be initialized at the same time, the void Start() and void Update() method of each gameobjects will be invoked one by one.
this is how Unity scripts works in my imagination(if I am wrong, please correct me)
Create a sample Holotoolkit Project
Ok, let's return to Holotoolkit, we first create a empty project "UnderStandingHolotoolKit", like this:
importing Holotoolkit package:
Choose the 2017.1.0 version, and get this result:
Delete the Main Camera and add HoloLensCamera from HoloToolkit.Input.Prefabs
Add a BasicCursor from HoloToolkit.Input.Prefabs.Cursor
Add an InputManager from HoloToolkit.Input.Prefabs
what you see in the Hierarchy should be like this:
Now we have a basic environment using Holotoolkit, normally if you want to play with Hololens, this is the minimum settlement which could not be less, and this setting contains nearly everything you need to continue programming
let's continue;
Save above as a scene(panel1)
the settings above is just a basic frame, you can not see anything if you run this in device or Simulator, let's add a cube, like this:
Try to play in the Unity Editor or device or Emulator, you will see the cursor appearing on the surface of the Cube
Wow, this is cool, we didn't code a single line, and the Holotoolkit help us adding Cursor on the object we created, but how is this working? what happened under the hook?
I will show you the answer on next post