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

Creating camera shakes with the Animation View and the Animator Controller


In this recipe, we will use a simple, but very effective method for creating camera shakes. Those effects are often used to emphasize impacts or explosions in our games.

 

Getting ready

You don't need anything special for this recipe. We will create everything from scratch in Unity. You can also download the provided example Unity project and go to the Chapter 07 Special effects\Recipe 02 Creating camera shakes with the animation window and the animator controller directory. When you open the  Example.unity scene and play the game, you can press the space bar to see a simple camera shake effect.

How to do it...

To create a camera shake effect, follow these steps:

  1. Create an empty game object in the Scene View and name it CameraRig.
  2. Parent the Main Camera to the CameraRig.
  3. Select the Main Camera and add an Animator component to it.
  4. Open the Animation View.
  5. Create a new Animation Clip and call it CamNormal. The camera should have...