Adjusting and animating HoloLens/Mixed Reality holograms using Unity animations

Published on 28 January 2019 by Joost. Reading time: 8 minutes.

Ofcourse you can script literally all animations using (something like) LeanTween, but you can also animate things using Unity animations. I have been using it primarily for basic repetitive animations, like the spinning of aircraft propellers or and helicopter rotors in AMS HoloATC. Sometimes models come with built-in animation, sometimes they don't. You can add it yourself, with some fiddling around.

First, a model...

I wanted to show the model I used for AMS HoloATC, but I could not find it anymore. The trouble with Asset Stores is that people may add models as they see fit, but can also can remove them again. So for this sample I took another helicopter - this free model of a Aerospatiale 342 Gazelle.

Adjusting and animating Hololens 1


..then a project...

This is the usual stuff:

  • import the Mixed Reality toolkit
  • configure the scene, project and capability settings
  • then import the model into your project


... and then we find the rotor components

We drag the helicopter inside the Hierarchy (it will appear at 0,0,0 with rotation 0,0,0) and we rotate the view so that we look on top of it. We want the rotor to animate, so we will need to find out which of the components make up the rotor. If you click a rotor blade once it will select the whole helicopter, but if you click it again, the hierarchy will jump to the actual sub component making up a rotor blade.

Adjusting and animating Hololens 2

So the blade pointing to top/left is "Component#5_001". The other rotor blades are "Component#5_002" (pointing right) and "Component#5_003" (pointing bottom/left). We also identify the top of the rotor, which is component "Component#9_001"

Adjusting and animating Hololens 3

What you now need to do is create an empty game object "Rotor" inside the helicopter game object and drag the four components inside the Rotor game object. Unity will warn you that you are breaking things...

Adjusting and animating Hololens 4

...but in this case it doesn't matters.

Adjusting and animating Hololens 5

Done! Now we can rotate the rotor. But the observant looker has already spotted there is a problem, that will become apparent it we set the Y rotation of new "Rotor" object to for instance 150.


Adjusting and animating Hololens 6

Great. The pivot point of the rotor - the point where the red and blue arrows hit the green square - is apparently not the visual center. This seems to happen rather often with imported models. I am not quite sure what causes it, but I know how you can fix it. And I am going to show it, too.


Some advanced fiddling to make the visual center the pivot point

First of all, make sure the Tool Handle Position is set to Pivot:

Adjusting and animating Hololens 7

You will find this at the top left of the scene window.

Set Rotor Y rotation back to 0, create an empty game object "InnerRotor" inside "Rotor" and drag all the components inside InnerRotor. Like this:

Adjusting and animating Hololens 8

.. and then you select the Rotor component, and press ALT+D, duplicating the Rotor component.

Then you select the Rotor component again. If you view the Pivot Point - actually sporting three arrows in this view - you will see it's quite a bit from where we want the center of the rotor to be. You will need to move that point manually to where the visual center of the Rotor is. The copy of the Rotor will help you identify that point.

It takes quite some fiddling to get it right. After a few minutes of playing around, I came to these values:

Adjusting and animating Hololens 9

... but now the actual visual rotor is floating high about the helicopter!

Adjusting and animating Hololens 10

This is where the InnerRotor object is for. For X/Y/Z values enter the exact negative values of Rotor, so:

Adjusting and animating Hololens 11

And boom. The Rotor falls once again on the helicopter. And now if you set the Y rotation for Rotor to 150:

Adjusting and animating Hololens 12

You can check if the rotor stays in place by selecting the Y rotation textbox and click-and-drag over that, the rotation will then change and you get view like the rotor is actually rotating a bit.

If you do this yourself on another hologram and the rotor still does not stay in the center while rotating, set InnerRotor position values back to 0, and fiddle a bit more till it fits. It also help to make the total model bigger (so the whole of the helicopter) while doing this. For some reason it's hard to zoom in on small models, but easy on big ones.

Once you are satisfied, you can delete or disable the Rotor (1) copy as we don't need it anymore. After you have done this, it is maybe a good moment to make a new prefab of your adapted helicopter.


And now - finally some animation

It took me quite some fiddling around to find the finer details of the timeline editor so I am writing a very detailed step-by-step guide.I am sure there are smarter ways to do this, but this is how I start:

  • I select the game object I want to animate
  • Then I click Window/Animation and that brings up this pane:

Adjusting and animating Hololens 13

Default this window appears as a floating window. I just drag it in the bottom pane with the Game and Console windows.

Then I select the Create button. This prompts me to make an animation file, which I make in an Animation folder:

Adjusting and animating Hololens 14

And then we get another button:

Adjusting and animating Hololens 15

If we click "Add Property" we get this popup:

Adjusting and animating Hololens 16

Expand the Transform entry:

Adjusting and animating Hololens 17

Then click the + behind "Rotation". This will add the Rotor rotation to the timeline. People who have ever used Blend will not suddenly sit up straight because they seem something familiar - I know I did!

Adjusting and animating Hololens 18

Expand Rotor: Rotation

Adjusting and animating Hololens 19

At the 1:00, click the top diamond, all the diamonds at the 1:00 mark will turn blue:

Adjusting and animating Hololens 20

And then hit the delete button on your keyboard. All diamonds at the 1:00 mark will disappear.

Now click at the timeline bar on top, at the 0:10 mark:

Adjusting and animating Hololens 21

The time line will jump to 0:10 If you look at the inspector a the Rotor's properties, you will notice the properties for Rotation X/Y/Z have turned blue:

Adjusting and animating Hololens 22

Change Y into 120 (it will turn red):

Adjusting and animating Hololens 23

Now, and this is the tricky part: double click in the timeline editor at the place where the white vertical line intersects with an imaginary horizontal line through the "Rotation.y" property text:

Adjusting and animating Hololens 24

X marks the spot. This should be the result:

Adjusting and animating Hololens 25

Now click at the top bar again, at the 0:20 mark. Change the value of the Y rotation in the inspector to 240 and double-click at the imaginary intersection point again. Repeat for the 0:30 mark, here use value 360.

Then click the little play button on the Animation and the rotor will be spinning. You will noticed that the speed is a bit stuttering, but you can speed it up a little as by increasing the Samples displayed in this video below:

Job done. Now finally drag the Helicopter over the already created prefab, and you can create as many animated helicopters as you want. As soon as you hit Unity's "Play" button, all rotors will start spinning.



The animator is powerful but not very intuitive at first, hence the step-by-step thing I wrote. It is pretty powerful though, especially for simple repetitive animations. I am sure you can do lots more with it. Be aware all this animations use a bit of performance, so spawning 15000 helicopters with spinning blades in a HoloLens may not be such a great idea. I think that will be true for helicopters without spinning rotors too, but that's not the point.

The demo project (containing 3 helicopters) called "GetToTheChoppa" can be downloaded here.

Tags: Mixed Reality


Published by Joost on 28 January 2019

Joost van Schaik has 25 years IT experience and has been working in Geographical Information Systems, Azure Cloud development and Cross-Platform Mobile (Xamarin) Development. He is currently focusing on Mixed Reality: he was a HoloLens and Windows Mixed Reality pioneer since the very beginning, authored 2 apps in the store and several for various customers. He is an active community member, has been blogging about a plethora of technical subjects since 2007 and as a result, has been awarded Microsoft Most Valuable Professional since 2011.


Comments? Share them below

Learn more about ETTU

And the way we work