Creating A Simple Smooth Camera Controller For A 2D Unity Game
Today I am creating a camera controller to follow the player, including offsets, dead-zones, and movement smoothing.

Today’s Objective: Create a good quality yet simple camera controller to keep the player in frame regardless of speed, while moving smoothly.
The Code:
I create a new script called “CameraController”, and create variables to manage the deadzone, smoothing, and move speed:


The functionality is simply lerping to the target position each frame, while clamping the position within the deadzone:

Because the position is set in the FixedUpdate, it smoothly follows the physics of the character’s movements for the most part with little visible flickering.
