Objects with Multiple Moving Parts
You may want to animate Game Objects that have multiple moving parts, such as a gun turret with a moving barrel, or a character with many body parts. There is always one Game Object that controls the animation of all the movable parts, and that is the Game Object that has the Animation Component on it.
The Animation Component attached to a Game Object can control that Game Object and any of its child Game Objects. However, if the Game Object has a parent, the parent cannot be controlled, since it can only control things that are lower in the hierarchy than itself. For this reason, if you want to create an animation with multiple moving parts, the Animation Component must be attached to a Game Object that is higher in the hierarchy than (or equal to) all the movable parts. Thus, the Animation Component is often placed on the root Game Object.
Animating Child Game Objects
When you edit Animation Clips with the Animation View, the animation data will always be stored relative to the Game Object with the Animation Component. The Game Object with the Animation Component is shown at all times in the leftmost selection box in the Animation View.
You can animate a child Game Object by unfolding that Game Object in the property list of the Animation View - just click the small triangle.
Child Game Objects can be unfolded in the property list of the Animation View.
Alternatively you can just select the child Game Object you want to animate by clicking it in the Hierarchy View. When a child Game Objects is selected in the Hierarchy View, only that Game Object is shown in the property list of the Animation View. However, the animation data is still stored relative to the Game Object with the Animation Component, which is shown in the left of the two selection boxes.
The child Game Objects selected in the Hierarchy View is shown in the Animation View. The Game Object with the Animation Component is shown in the left of the two selection boxes.
Handling Multiple Animation Components
If a Game Object has an Animation Component and one of its parent Game Objects also have an Animation Component, the leftmost selection box can be used to select which Animation Component to animate according to.
If you want to animate a Game Object relative to a different Animation Component than the nearest one, just select it in the left selection box.
As an example, you may have a multiple characters (Hero and Sidekick) that each have an Animation Component that is used for playing back Animation Clips for running and jumping etc. At the same time you may have a Game Object with an Animation Component used for controlling cutscenes. A cutscene could have both Hero and Sidekick walking around, animating their global positions in the scene. In order for the CutsceneController to be able to control the positions of the Hero and Sidekick, it must have them as child Game Objects.
Now, if the Hero Game Object is selected in the Hierarchy, the Animation View will as default assume that you want to edit the animations of the Hero Game Object itself - since it has its own Animation Component. If you want to animate the Hero Game Object as part of a cutscene controlled by the CutsceneController, you need to tell that to the Animation View: Just select the CutsceneController in the left .
Page last updated: 2009-09-29