This How To will show you how to create a turntable animation as commonly used in product presentations. It features a step by step introduction to the State Engine and is written for beginner to intermediate level users.
In case you don't know what a turntable animation is, imagine a car in a show room. You're standing in front of the car as it sits on a large cylinder that appears to be part of the ground. While you're looking at it, the car slowly turns and shines as the reflections and your viewing angle change all the time.
The simplest way to achieve something like this is to use an Axis Node and bind its Y-rotation to the output of a Mover Node. Set the Mover to Linear function without Swing, Minimum to 0, Maximum to 360, Duration to 100 ... and we're done. So why write a How To about it? Well, this is fine if you just want it to be rotating all the time. Putting some extra effort into it and using the State Engine instead can bring your presentation to a completely new level.
We will keep the general setup of the scene pretty simple. In fact, it will be pretty much the same as if we had used a Mover as described above:
All that remains is to animate the Z-Rotation of the Turntable axis. If everything worked, the hierarchy of your scene should look like this:
Double click in the middle of the connection between S1 and S2. This should bring you back to the Time View. Most likely the Animation is too long to fit into the editor, so press the "Zoom into View" button (looking glass with 1:1). You'll see your Animation Channel, five blue lines representing
the four states (S1 is used two times) and blue squares representing the keyframes.
Lets review what we have achieved. Drag the red line around. Start at the left and move it over to the right. Up to S4, everything looks great. But S4 to S1 rotates from 270 to 0, not 270 to 360. We cannot simply set S1 to 360 as there is only one keyframe for that state and using anything than 0 will break the transition from S1 to S2.
The solution is to use a state that has more than one keyframe, which is called a Soft State. Go back to the Logic View, click on the green circle to select S1 and press delete to remove it. Now use the button on the left showing a circle with a hole in it. Press it and you get a new Soft State. Since S1 no longer exists, the Soft State will use that name. We need to reconnect the state to S2 and S4. So again right click and drag from S1 to S2 and from S4 to S1. Do not drag from S1 to S4 but S4 to S1, we will see later why.
Go back to the Time View. We now have multiple tabs, each showing a different Slice. As long as its possible, the Animation Editor will try to put all the transitions you create on to a single slice. But since we removed stuff, the new transitions get separate slices.
S2 to S4 are the remains of our old animation. Make sure the keyframe still say 90, 180 and 270. Then start with S1 to S2 by switching to that tab. You will notice that S1 no longer has a keyframe. So make sure the Animation Channel is still selected, move the red line to S1 and press the "add keyframe" button (two orange dots with a plus sign). Change the value of the new keyframe to 0. Go to "S4 to S1", do the same for S1 here and set the value to 360.
Go back to the Logic View to check if things have improved. We are not going to scrub the time line (i.e. moving the red line) but use the state logic. First, we have to fix one more thing. Did you notice that the new Soft State is blue and not green like S1 previously was? That means the State is no longer marked as the "Begin" state. Select S1 and in the Property Editor, change the Type property to "BeginDefault".
Now we're ready. In the Animation Editor, there is a button with a green circle. Press it and the State Machine will go to S1. Right next to it is a green "play button". Press it and your turntable should start to rotate to 90 degrees. Press it again and it will continue from 90 to 180 degrees and so on and so on. You can press it as often as you want, it will always rotate to the next multiple of 90 degrees.
This is why we set connect from S4 to S1 and not from S1 to S4. Did you notice the little green and orange triangle on the connections? When you press next, the State Engine will check at which State it currently is and use the connection that has the green triangle.
You can either let the user trigger next by binding it to some navigation element (i.e. using Touch Button) or bind it to a Mover that fires an event every time its duration is reached.
If you're still asking yourself why all the hard work, consider this:
We hope you got inspired by seeing this very basic usage of the State Engine. Using States can give a presentation a higher level structure while still giving the user complete freedom of timing and order of events. After working with it for a while, you will not want to go back to linear animation systems found in other 3D software ever again...
For more information, see Animation and State Engine.