Skip to content

Instantly share code, notes, and snippets.

View monxa's full-sized avatar

monxa

  • Germany
View GitHub Profile
@monxa
monxa / smooth_camera_zoom_and_pan.gd
Created February 8, 2025 13:21 — forked from Tam/smooth_camera_zoom_and_pan.gd
A smoothly panning and zooming camera for Godot 4 (now with mouse edge panning)
extends Camera2D
# Note: Limit smoothing and position smoothing must be disabled
const V2_2: Vector2 = Vector2.ONE * 2
const PAN_SPEED: int = 2000
const PAN_SMOOTHING: int = 8
# How far from the edge of the screen panning starts (% of screen size)
const EDGE_PAN_THRESHOLD_MIN: Vector2 = Vector2(0.06, 0.12)