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

Changing cameras with animation


Not only can we animate cameras using the Animation View, but we can also change the shots in time.

Getting ready

This recipe will also be created from scratch in Unity. You can download the example Unity project provided and go to Chapter 08 Animating Cutscenes\Recipe 02 Changing cameras with animation directory. You can find a Camera Changer game object in the Example.unity scene there, with three cameras as children. If you play the game, the cameras will change.

How to do it...

To change cameras using animation, follow these steps:

  1. Create an empty game object in the Scene View and name it CameraChanger.
  2. Rename the Main Camera to Camera (1) and copy it two times. You should have Camera (1)Camera (2), and Camera (3) game objects.
  3. Parent all three cameras to the CameraChanger.
  4. Place the cameras as you wish.
  5. Set the Depth of the cameras in increasing order. Every new shot should have a greater Depth value.
  6. Select the CameraChanger game object and open the Animation...