In this video, we go through the provided camera shake code.
The camera shake consists of offsetting the view from the current
camera position. Godot’s offset
property to
do that.
Our camera shake relies on a noise generator. You learned about noise when working on the random rocks series. The calculation that offset each rock was the foundation for noise.
Godot has a powerful built-in noise generator called Open Simplex Noise.
It’s an algorithm that can generate smooth series of random numbers. It is perfect for camera shake as we want to create a motion that is erratic yet continuous.
Godot’s noise generator allows us to get that motion with little code.
For more information, I invite you to open the
ShakingCamera.gd
script in the project, where you will find
detailed comments.
We will look at the provided bullet and spell code in the next video.