In this recipe, we will explore local transform animations further. We will use the Hierarchy
and create smart parent-child relationships between our game objects to make an interesting effect of orbiting planets. Learning how to animate an object's local position and rotation and use the Hierarchy
to our advantage is key to getting the most of Unity's animation system.
Before we start, you need to prepare at least two objects to animate. We are using planets in this example. You can also use the example Unity project provided and go to the Chapter 02 Working with the animation view\Recipe 05 Using the hierarchy to animate local rotation - creating an orbiting planet
directory. You will find an Example.unity
scene there. There is a Planets
game object with an Animator component and an Animator Controller assigned. If you select the Planets
game object and go to Window | Animation
, you can edit the animation...