Book Image

Unity 5.x Animation Cookbook

By : Maciej Szczesnik
Book Image

Unity 5.x Animation Cookbook

By: Maciej Szczesnik

Overview of this book

This recipe-based practical guide will show you how to unleash the power of animation in Unity 5.x and make your games visually impeccable. Our primary focus is on showing you tools and techniques to animate not only humanoid biped characters, but also other elements. This includes non-humanoid character animation, game world creation, UI element animation, and other key features such as opening doors, changing lights, transitioning to different scenes, using physics, setting up ragdolls, creating destructible objects and more. While discussing these topics, the book will focus on mecanim, the Unity 3D animation tool, and how you can use it to perform all these tasks efficiently and quickly. It contains a downloadable Unity project with interactive examples for all the recipes. By the end of this book, you will be confident and self-sufficient in animating your Unity 3D games efficiently.
Table of Contents (17 chapters)
Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Using rigid body joints


In this recipe, we will create two objects with physics simulation: a rope and doors. We will use rigid body joints to constrain the movement and rotation of those objects.

Getting ready

For this recipe, we need four models: a RopePole (similar to the one from the previous recipe), a skinned Rope with a RopeRig containing around 10 bones,  a Frame and two doors, DoorLeft and DoorRight (resembling those swing doors from a saloon). We also need a character with a rigid body to collide with our objects. You can go to the Chapter 09 Physics and animations\Recipe 02 Using rigid body joints directory. You will find all these objects in the Example.unity scene. When you play the game, try to walk with our character and collide with the rope and doors to see the effect.

Rope and swing doors

How to do it...

To use rigid body joints, follow these steps:

  1. Import our swing doors to Unity. The model should contain three objects: FrameDoorLeft, and DoorRight.
  2. Place the objects in the...