Camera Shake System in Unity (Using Perlin Noise)

Lock-On Camera System in Unity (Target Locking for Combat Games)
July 14, 2026
Game Feel in Unity
The Complete Guide to Game Feel in Unity
July 17, 2026
Lock-On Camera System in Unity (Target Locking for Combat Games)
July 14, 2026
Game Feel in Unity
The Complete Guide to Game Feel in Unity
July 17, 2026

Camera Shake System in Unity (Using Perlin Noise)

Camera shake is a powerful visual effect used in many games to enhance impact and immersion.
It is commonly triggered by explosions, weapon fire, player damage, or environmental events.

A naive implementation using random values can feel jittery and unnatural.
Instead, many modern games use Perlin Noise to create smooth and organic camera movement.


Why Use Perlin Noise for Camera Shake

Random values change abruptly between frames, which makes the camera feel chaotic.

Perlin Noise produces smooth transitions between values, creating natural motion that feels more cinematic.

  • Smooth movement
  • Natural-looking vibration
  • No sudden jumps
  • Highly controllable intensity

Basic Camera Shake Implementation

First we store the camera’s original position and apply Perlin Noise offsets to it.

using UnityEngine;

public class CameraShake : MonoBehaviour
{
    public float duration = 0f;
    public float amplitude = 0.3f;
    public float frequency = 2f;

    private Vector3 originalPosition;
    private float shakeTime;

    void Start()
    {
        originalPosition = transform.localPosition;
    }

    void Update()
    {
        if (shakeTime > 0)
        {
            shakeTime -= Time.deltaTime;

            float x = Mathf.PerlinNoise(Time.time * frequency, 0f) * 2 - 1;
            float y = Mathf.PerlinNoise(0f, Time.time * frequency) * 2 - 1;

            Vector3 offset = new Vector3(x, y, 0) * amplitude;

            transform.localPosition = originalPosition + offset;
        }
        else
        {
            transform.localPosition = originalPosition;
        }
    }

    public void Shake(float shakeDuration, float shakeAmplitude)
    {
        duration = shakeDuration;
        amplitude = shakeAmplitude;
        shakeTime = shakeDuration;
    }
}

Triggering Camera Shake

The shake effect can be triggered when events occur, such as explosions or player damage.

public CameraShake cameraShake;

void Explode()
{
    cameraShake.Shake(0.4f, 0.5f);
}

Decay Over Time

To make the shake feel more natural, the intensity can fade out gradually.

float decay = shakeTime / duration;

Vector3 offset = new Vector3(x, y, 0) * amplitude * decay;

This causes the shake to start strong and slowly fade away.


Rotational Camera Shake

Instead of only moving the camera position, rotation can also be applied for stronger effects.

float rotation = Mathf.PerlinNoise(Time.time * frequency, 1f) * 2 - 1;

transform.localRotation =
    Quaternion.Euler(0, 0, rotation * amplitude * 5f);

Using Cinemachine for Camera Shake

If you use Cinemachine, camera shake can be implemented with the
Cinemachine Impulse System.

This allows designers to trigger shakes from explosions, impacts, or scripted events without custom code.


Performance Tips

  • Keep shake calculations lightweight
  • Use local position offsets instead of global transforms
  • Limit shake duration to avoid player discomfort
  • Combine shake with sound and visual effects for stronger impact

Conclusion

Camera shake is a small feature that greatly enhances game feel. By using Perlin Noise instead of random values, developers can create smooth, natural motion that improves immersion during intense gameplay moments.

When combined with explosions, weapon recoil, and environmental effects, camera shake helps bring your game world to life.


Leave a Reply

Your email address will not be published. Required fields are marked *


Skip to toolbar