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:
- Create an empty game object in the
Scene View
and name itCameraRig
. - Parent the
Main Camera
to theCameraRig
. - Select the
Main Camera
and add anAnimator
component to it. - Open the
Animation View
. - Create a new
Animation Clip
and call itCamNormal
. The camera should have...