Animating body parts for character movement events
In the previous recipe, we used the Unity animation tool to alter the transition of a sprite based on input. In this recipe, we’ll learn how to animate the hat of the Unity PotatoMan character in response to a jumping event using a variety of animation techniques, including keyframes and transforms.
Getting ready
For this recipe, we have prepared the files you need in the 08_03 folder.
How to do it...
To animate body parts for character movement events, follow these steps:
- Create a new Unity 2D project.
- Import the provided
PotatoManAssetspackage into your project. - Increase the size of
Main Camerato10. - Set up the 2D gravity setting for this project – we’ll use the same setting that’s provided in Unity’s 2D platform tutorial – that is, a setting of Y=
-30. Set 2D gravity to this value by going to Edit | Project Settings | Physics 2D and changing...