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 root motion for a 180 degrees turn


In the previous recipe, we've added a stop animation for a better transition to the idle state. We can add even more animations to our movement to make it more accurate and responsive. An example of such animation is a 180-degree turn.

Getting ready

Use the same character as in the previous recipe. Add a 180-degree turn animation, starting with the Idle pose and ending with the Idle pose rotated by 180 degrees in the vertical axis. Name the animation 180Turn for clarity. You can open the provided example Unity project and go to the Chapter 04 Character movement\Recipe 05 Using root motion for a 180 degrees turn directory. You will find an Example.unity scene there. Play the game and try to walk in the direction opposite to the one the character is facing (press the down arrow). You can find the Humanoid.fbx asset in the Rigs directory with all the required animations.

How to do it...

To make a 180-degree turn, follow these steps:

  1. Create four transitions...