O'Reilly logo

Unity 5.x Animation Cookbook by Maciej Szcześnik

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

How to do it...

To animate the trigger position and create a death trap, follow these steps:

  1. Create an empty object in the scene and name it Trap. It will be a parent object for our moving parts.
  2. Put your models into the scene and parent them to the Trap game object. The models should have descriptive names, for instance, LeftTrap and RightTrap.
  3. Add an Animator component to your Trap game object (the root object of our death trap). Set the Update Mode to Animate Physics.
  4. Go to Window | Animation and open the Animation View.
  5. Create a new Animation Clip by clicking on the Create button.
  6. Select the LeftTrap game object and make sure the record button is pressed (in the upper-left corner of the Animation View).
  7. Move the LeftTrap game object ...

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