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 IK for interacting with scene objects


Sometimes our characters need to interact with objects in the scene. Most likely we will need to have a solution for picking up items from the ground or other objects. This recipe shows a simple solution for that.

Getting ready

In this recipe, we are using only two animations: Idle and Pickup. The second one makes the character pick something from the ground. You can go to the Chapter 05 Character actions and expressions\Recipe 07 Using IK for interacting with scene objects directory. You will find an Example.scene there. Open it, play the game, and press the space bar to see the character trying to pick up an object from the ground. You can move the object and play the game again. The character will still try to reach the object.

Character trying to pick an object from the ground

How to do it...

To use IK to interac with scene objects, follow these steps:

  1. Import the character to Unity. Make sure to have the Idle and Pickup animations and set the rig...