Shake, Shake, Shake! — Camera Shake Effect

Daniele Quero, PhD
3 min readAug 5, 2021

Objective: Add a shake effect playing along each explosion

This is going to be as easy as funny!

What we are looking for is a shake or quake effect: when something explodes there has to be this tremble feeling.

In order to do so, it’s easy to figure out that 2 ways are possible, equivalent in result but very different in effort: either everything on scene shakes or the camera does. Obviously the second choice is way easier to implement. Let’s see how.

First, let’s add a new animation to the camera itself, as already did for explosions.

In defining what the animation will do, let’s add a property: camera position. The idea is to rapidly change camera position (the visual will change along) to simulate the effect we are looking for.

Now it’s all fun! Let’s open the Curves view, select both x and y (z camera position has to remain unchanged) and modify the curves as you wish! Remember to end both curves in 0 value and to make them oscillate around 0 a few, without exceeding in positive or negative values. Make it shorter than a second and avoid regular curves such as sine: the more irregular and chaotic the closer to what we are looking for!

Did you have fun? Good!

As did before, let’s edit the layer view of the animator introducing an empty default state and a transition dependent on a trigger parameter.

The transition back to default is to be automatic. A little reminder: deactivate loop option in animation, deselect Exit time in transition default->shake but leave it in shake->default.

All it remains to do is to trigger the animation upon explosion, for example for the asteroid: grab the animator component of the camera and set the trigger right after setting the one for explosion!

Here is the result, pretty cool… I’m quite proud of it :)

--

--

Daniele Quero, PhD

A professional developer with passion for game developing and skill-growing. A former Nuclear Physics Researcher who changed his life to pursue his dreams