06 October 2016

A HoloLens airplane tracker 2–Setting up the project and getting airplane assets


All right my friends, it’s time to hit Unity again. In a previous blog post about the Cube Bouncer I have told you how to set up a project. That was quite a convoluted procedure. Luckily, things have improved considerably since, especially where it comes to the HoloToolkit. So this ‘setting up’ post will be a lot shorter and simpler.

Creating the project

Don’t start with creating a project – first find the HoloToolkit here on GitHub, and clone it at some place on your disk. Then follow carefully the first two steps of procedure as described here.

Then you create the Unity project.


Initializing the project

Proceed with following the third step of the getting started document: import the package. This will give you two folders in your Assets folder plus some stuff in the root – and an extra menu-item, called “HoloToolkit”



I usually delete everything under HoloToolkit-Examples. And then I hit File/Save Scene to save the current scene as “Main”. Now do the fourth step of the getting started document. I usually skip the step of adding ManualCameraControl.cs to the camera. Allow Unity to reload the project when it has to, and accept it’s offer to save the Main scene when it asks to. Now your project has been set up the way the HoloToolkit people think it’s a good default. Only I don’t quite agree with all settings, so we are going to change a few ;)

Tweaking the camera

There are two major things I want to do to the camera:


Every manual about the HoloLens I saw so far say you should put the camera at 0,0,0 and the near clipping plane at 0.85m. To make things clear – the clipping plane is the minimum virtual distance you can get to a Hologram before it winks out. I found it to be very cool to be able to get up close to the airplanes and the airport and see the amazing level of detail HoloLens is capable of. As to the camera location – this is essentially a 3D map, I am a GIS person – and a stubborn b*st*rd as well. So I put 0,0,0 at the center of my display data, a logical origin – the center of Schiphol airport according to Google Maps. The camera then is stationed a little South and above it. So when the app starts, you will see Schiphol float about 2 meters before you and 25 cm down from your horizontal line of sight. You will be looking due North - which gives you a nice and compelling overview of airplanes going out over the ocean and around Amsterdam, or coming into it.

After you have made the settings, double-click the camera in the hierarchy.

Directional light

Basically this can be whatever you like, but I opted to put it right over the airport.


The hat stand

Finally, add an empty game object “HologramCollection” to the main scene by right-clicking in the hierarchy, and select “Create Empty”. Make sure both position and rotation X, Y and Z are all 0 (zero) and Scale all 1:


This will be the hat stand – the place where all other Holograms will be placed in or moved within.

Getting the airplanes assets

There is of course the awesome Unity Asset store, but there is also a great site where you can find a lot of free (and paid) 3D models. It’s called an awesome site called CGTrader and claims to have 520000 3D models to choose from.


Models are available in a range of formats – we will need to have an airplane that is provided in OBJ or FBX format, because that is what Unity likes to have. You can just look for “aircraft free” and find a lot of airplanes Lo and behold, here’s a beautiful A320 and it’s free, too:


Before you use a model, make sure the license allows you to do so. When in doubt, contact the person who uploaded it – the site offers that capability. In my case, I contacted a person called Maxim Kraft and he (I assume he) graciously gave me permission to use it. He has a whole range of excellent models – check him out!

Anyway - hit “Free download” and select “3d-model.fbx.zip”. Unblock and unzip the file. Rename the file that comes out of it 3d-model.fbx – to A320.fbx. Then go to Unity, make a folder “A320” in the root and drag the A320.fbx from your explorer on top of it. Net result should be this:


And if you drag the A320 on top of your scene (don’t!) you will see this ginormous airplane (and this is zoomed out considerably!)


That clearly needs to be scaled down a little first. We will do that in the 4th blog post of this series.

A word about source control settings

I had quite some ‘fun’ getting this solution properly in source control. I am not absolutely sure this is necessary, but I think – at least for Git – it is. Hit Edit/Project Settings/Editor and select “Visible Meta Files”


As to the rest – I am not a Git guru. I have included two .gitignore files, one for the FlightDataService in my previous post, and one for the Unity project. I have learned the hard way that for checking in Unity projects in Git, you make sure that everything in Assets and ProjectSettings gets checked in. As far as these directories are concerned, there is no such thing as an ignored file. So make sure everything under that is added to your repo. This includes dlls.

Code so far can be found here. That’s a short post, eh? I did say the procedure for setting up a project was dramatically simpler now, and it is indeed!

The code, as always, can be found online – here on github


Skons35 said...


Thanks for taking time explaining the project set up and for other c# tricks to come.

i was just wondering, regarding the airplane you seems to use (Airbus A330), if there was some licence issue on using that model for a distributed app. It seems available Under "Editorial License", that seems not to allow commercial, promotional work to use it (is it not the kind of app you developped ? is demo purpose some kind or promotional work ,i mean) ?

i'm a little focused on such licence details, sorry, as i'm trying currently to build demo myself, but of course i intend to use available 3D assets also, as i'm not a 3D asset geek ;-).

Thanks again for your usefull information.

Joost van Schaik said...

@Skon35 that is an excellent remark for which I thank you. Coming from a world of code, where everyone I know just places everything under MIT license on GIT - I did not even stop and think about the licensing of a free model. And you are COMPLETELY right.

Because the author not always uses the same licensing, I decided to contact him (CGTrader has an excellent mechanism for it), and he wrote indeed the models were free to use, and the only thing he hoped to achieve with the licensing thing was proper credits being attributed. I did a little revising of the blog, linking to his work with a recommending and this attribution was very much to his liking.

So there you are. I hope I learned you something - but you DEFINTITELY learned ME something - and my reader too, I hope. Thank you for your great contribution to this blog. This is what I love being in a developer community - random strangers educating each other. :) Cheers!