O'Reilly logo

Unity 5.x Cookbook by Chico Queiroz, Matt Smith

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Animating body parts for character movement events

In this recipe, we'll learn to animate the hat of the Unity bean-man character in response to a jump event.

Getting ready

For this recipe, we have prepared the files you need in folder 1362_03_02.

How to do it...

To animate body parts for character movement events, follow these steps:

  1. Create a new Unity 2D project.
  2. Import the provided package BeanManAssets, by choosing menu: Assets | Import Package | Custom Package …, and then click the Import button to import all these assets into your Project panel.
  3. Increase the size of the Main Camera to 10.
  4. Let's setup the 2D gravity setting for this project – we'll use the same setting as from Unity's 2D platform tutorial, a setting of Y= -30. Set 2D gravity to this ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required