A Smooth Camera
Part of the Game Feel section of Coddy's Godot journey. Lesson 10 of 23.
A camera fixed to the player starts and stops with sudden jerks. A camera that trails a little behind and then catches up moves more softly.
Camera2D does this with position smoothing.
position_smoothing_enabled = true
position_smoothing_speed = 4.0The first line turns smoothing on. The speed sets how fast the view catches up. A small number trails far behind, and a big one hardly trails. Godot's default is 5.
The camera node still moves with the player. Only the view on screen lags behind.
Challenge
EasyTurn on the camera's position smoothing, with a speed of 4.0. Keep the limits.
Try it yourself
extends Camera2D
func _ready():
limit_left = 0
limit_top = 0
limit_right = 1600
limit_bottom = 360
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Game Feel
Practice on your own: Godot playground