“Funslingers” Devblog #30 | Camera Shake!

Ethan Bristowe
Everdevs Community
Published in
2 min readOct 27, 2021

A great way to improve the “feel” of your game, is by creating some interactivity with the game’s camera. A very easy and popular example of this is by adding some camera shake whenever the player is supposed to be experiencing some recoil, by either shooting a gun, slashing a sword, or taking a hit!

Since this camera shake only occurs in relation to the player’s actions, we can do all this in the Player script.

First things first is setting up our variables! We’ll grab reference to our camera’s transform, and setting a Vector3 for the starting position of the camera, since we’ll want to be able set it to it’s original position after we shake it around.

Next things next is programming our camera shake! We’ll make it very straight forward and use a Coroutine to make micro adjustments to the camera position in-between some WaitForSeconds() timers.

We established the camSpot Vector3 at Start(), and we can very easily call StartCoroutine(CameraShake()) anywhere we want it!

This really goes to show how much these small little details can really make a huge difference in your game!

--

--

Ethan Bristowe
Everdevs Community

Passionate self taught game developer excited to learn and share everything I can about game development!