$npx -y skills add thedivergentai/GD-Agentic-Skills --skill godot-camera-systemsExpert patterns for 2D/3D camera control including smooth following (lerp, position_smoothing), camera shake (trauma system), screen shake with frequency parameters, deadzone/drag for platformers, look-ahead prediction, and camera transitions. Use for player cameras, cinematic se
| 1 | ## Godot 4.7 Baseline |
| 2 | |
| 3 | - Expert patterns in this skill target **Godot 4.7+** (stable, 2026-06-18). |
| 4 | - Consult the [Godot 4.7 migration guide](https://docs.godotengine.org/en/4.7/tutorials/migrating/upgrading_to_godot_4.7.html) when upgrading projects from 4.6. |
| 5 | - **NEVER** assume 4.6 defaults (stretch mode, audio area_mask, RichTextLabel percent flags) without checking 4.7 migration notes. |
| 6 | |
| 7 | # Camera Systems |
| 8 | |
| 9 | Expert guidance for creating smooth, responsive cameras in 2D and 3D games. |
| 10 | |
| 11 | ## NEVER Do |
| 12 | |
| 13 | - **NEVER use `global_position = target.global_position` every frame** — Instant position matching causes jittery movement. Use `lerp()` or `position_smoothing_enabled = true` [12]. |
| 14 | - **NEVER use `offset` for permanent camera positioning** — `offset` is for shake, sway, or temporary recoil effects only. Use `position` for permanent framing to avoid logic conflicts [14]. |
| 15 | - **NEVER forget `limit_smoothed = true` for `Camera2D`** — Hard boundaries cause jarring visual stops. Smoothing against limits ensures a professional feel [13]. |
| 16 | - **NEVER enable multiple `Camera2D` nodes in the same viewport simultaneously** — Only the last enabled camera takes precedence. Explicitly disable inactive cameras [15]. |
| 17 | - **NEVER use `SpringArm3D` without a collision mask** — It will clip through terrain and walls. Set it to the world/environment layer [16]. |
| 18 | - **NEVER implement screen shake by randomizing `position` directly** — This overwrites follow-logic. Use `offset` or a dedicated Trauma/Noise system to Layer shake over the follow-position [27, 28]. |
| 19 | - **NEVER parent the Camera directly to a high-speed physics body** — Physics stutter or parent rotation will cause motion sickness. Use `RemoteTransform2D/3D` with rotation sync disabled for a stable view [30]. |
| 20 | - **NEVER use `look_at()` in 3D without a fallback for the 'Up' vector** — If the target is directly above/below, the camera will flip wildly. Use guards or `Quaternion` math for vertical tracking. |
| 21 | - **NEVER rely on `SubViewport` defaults for Mini-maps** — Viewports are expensive; explicitly set `render_target_update_mode` to `UPDATE_WHEN_VISIBLE` or a fixed lower framerate to save GPU [156]. |
| 22 | - **NEVER use linear interpolation for Zoom** — It feels 'robotic'. Use exponential lerp or a `Tween` with `TRANS_CUBIC` for a more natural tactical feel. |
| 23 | |
| 24 | --- |
| 25 | |
| 26 | ## Available Scripts |
| 27 | |
| 28 | > **MANDATORY**: Read before implementing camera behaviors. |
| 29 | |
| 30 | ### [camera_shake_trauma_pro.gd](scripts/camera_shake_trauma_pro.gd) |
| 31 | Advanced noise-based screenshake (Trauma system) for organic, non-jittery explosions and impacts. |
| 32 | |
| 33 | ### [cinematic_framing_logic.gd](scripts/cinematic_framing_logic.gd) |
| 34 | Rule of Thirds and Lead Room management in code, ensuring high-quality cinematic composition. |
| 35 | |
| 36 | ### [camera_state_machine.gd](scripts/camera_state_machine.gd) |
| 37 | Managing transitions between 'Follow', 'Static', and 'Cinematic' camera states with Tweens. |
| 38 | |
| 39 | ### [minimap_viewport_manager.gd](scripts/minimap_viewport_manager.gd) |
| 40 | SubViewport optimization for Mini-maps and UI overlays. Reduces render updates for better FPS. |
| 41 | |
| 42 | ### [split_screen_setup.gd](scripts/split_screen_setup.gd) |
| 43 | Dynamic split-screen architecture for local multiplayer, handling viewport stretching and audio listeners. |
| 44 | |
| 45 | ### [remote_transform_decoupling.gd](scripts/remote_transform_decoupling.gd) |
| 46 | Decoupling camera position from player rotation/scale using `RemoteTransform2D` for high-speed stability. |
| 47 | |
| 48 | ### [zoom_damping_controller.gd](scripts/zoom_damping_controller.gd) |
| 49 | Non-linear, smooth zoom logic with tactical overview bounds and mouse-wheel support. |
| 50 | |
| 51 | ### [spring_lerp_camera_3d.gd](scripts/spring_lerp_camera_3d.gd) |
| 52 | Physics-stable 3D follow camera using spring-mass interpolation to reduce follow-latency jitter. |
| 53 | |
| 54 | ### [first_person_sway.gd](scripts/first_person_sway.gd) |
| 55 | Procedural 8-figure head bob and weapon sway logic for immersive First-Person systems. |
| 56 | |
| 57 | ### [deadzone_drag_margins.gd](scripts/deadzone_drag_margins.gd) |
| 58 | Platformer-specific deadzone management using code to control follow-margins and drag-center behavior. |
| 59 | |
| 60 | --- |
| 61 | |
| 62 | ## Camera2D Basics |
| 63 | |
| 64 | ```gdscript |
| 65 | extends Camera2D |
| 66 | |
| 67 | @export var target: Node2D |
| 68 | @export var follow_speed := 5.0 |
| 69 | |
| 70 | func _process(delta: float) -> void: |
| 71 | if target: |
| 72 | global_position = global_position.lerp( |
| 73 | target.global_position, |
| 74 | follow_speed * delta |
| 75 | ) |
| 76 | ``` |
| 77 | |
| 78 | ## Position Smoothing |
| 79 | |
| 80 | ```gdscript |
| 81 | extends Camera2D |
| 82 | |
| 83 | func _ready() -> void: |
| 84 | # Built-in smoothing |
| 85 | position_smoothing_enabled = true |