Explosion effect - Camera shaking

Every explosion has a shockwave effect, and this is usually shown in videogames with camera shaking.
Unreal Engine has a built-in class that provides this kind of effect, so all we need to do is adding a new Blueprint class, and search for "Camera shake". I'll call it MyCameraShake.

In the Blueprint editor we can change the parameters of the shake effect. What we need are the following:


I set the duration to 0.4, so that it ends shaking just before the end of the visual explosion effect we created here.
Now, in the usual EnemyBP editor, we can chain this effect to the ones already playing when we have a collision:



The node to activate is "Play World Camera Shake", and we can assign it the class MyCameraShake.

The location where the shake effect starts doesn't really matter, we can use the enemy location as we did for the particle system.

The other 2 parameters to set are minimum radius: if the camera is placed within that radius from the location, it won't be affected by the shake, but we want it to happen always, so let's set it to 0.

Maximum radius works in the same way: if the camera is outside that radius, we won't see any shake; let's use a radius big enough to always see it, let's say 5000.

Compile, save all and play the game to see this result when we collide with an enemy:



Wow, this looks pretty convincing to me... In case you want a more subtle or a stronger effect, you can simply play with the parameters in the MyCameraShake blueprint!

Thanks for reading, and game you next time!

Commenti