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

Animating an object's world position - creating a moving platform


In this recipe, we will create a very common gameplay mechanism: a moving platform. We will use a Rigid body for our character and an animated, kinematic Rigid body for the platform.

Getting ready

Before we start, you should have a scene with your character and a platform you want to animate. You can use the example project; go to the Chapter 02 Working with the animation view\Recipe 03 Animating objects world position - creating a moving platform directory. There is a scene called Example.unity there. If you open it, you will find a Sheep character in the Hierarchy. This is our character, using the Rigidbody component and a Simple Move script to move. There is also a Moving Platform game object in the Hierarchy. This is the kinematic rigid body with a Platform script attached to it. It also has an Animator component and an Animator Controller with just one animation in it. This animation makes the platform move.

How to do it...