AIPM
Theme

AIPM package

Camera Systems

@gamedev-skills/camera-systems@1.0.0

>

Scanned · no issues · Nov 22, 2026

GitHub stars: ★ 10.0K

LinkedInPost

Install Skill

Pins this version in aipm.package.json and aipm-lock.json.

aipm add @gamedev-skills/camera-systems@1.0.0

Without project tracking

Writes the skill files only. Add --no-init to skip aipm.package.json and the lockfile.

aipm add @gamedev-skills/camera-systems@1.0.0 --no-init

How to use

Install the skill above, then run this in your AI tool:

/camera-systems <your description>

About

A good camera follows smoothly at any frame rate, leads the action, never shows outside the level and never clips through walls. This skill owns those techniques and maps them onto each engine's camera node or rig; prefer the engine's built-in rig before hand-rolling one.

Source

What gets added to your project

Preview every file this package writes on install before you run the command above.

Summary

>

Skill instructions

Camera systems

A good camera follows smoothly at any frame rate, leads the action, never shows outside the level and never clips through walls. This skill owns those techniques and maps them onto each engine's camera node or rig; prefer the engine's built-in rig before hand-rolling one.

When to use

  • A 2D camera should follow smoothly, ignore small movements, lead motion and stay in bounds.
  • A 3D third-person orbit or first-person look controller, or framing several targets.
  • Fixing jitter, snapping, motion sickness or a camera that peeks past the level.

Not this skill: shake magnitude and triggers (game-feel; this skill only exposes the offset), physics jitter of the body itself (physics-tuning), Camera3D and environment setup (godot-3d-essentials), player movement (godot-2d-movement or the engine movement skill), look-sensitivity input curves (input-systems).

Core workflow

  1. Decide what the camera serves. Platformer (lead the jump, see hazards), top-down (centre with deadzone), third-person (orbit plus collision), first-person (look only).
  2. Use the built-in rig first: Godot Camera2D smoothing, limits and drag margins, or SpringArm3D; Unity Cinemachine 3 (CinemachineCamera plus Position Composer, Orbital Follow, Deoccluder, Confiner). Hand-roll only what the rig cannot do.
  3. Smooth with 1 - exp(-rate * dt) or a critically damped spring (SmoothDamp), never a fixed lerp(a, b, 0.1) per frame.
  4. Add a deadzone, then look-ahead eased toward its goal so direction flips don't whip.
  5. Clamp the view, not the centre, to the level rectangle, accounting for zoom.
  6. For 3D, separate look from collision: yaw and pitch on a pivot, a spring arm or ray pulls the camera in, pitch clamped.
  7. Update after the target moves (late update, or after physics) and follow the target's interpolated transform when physics interpolation is on.
  8. Verify with a runnable check, then by eye. Step the follow code headless with a target moving at 300 px/s for 2 s at dt = 1/30 and at dt = 1/144, and compare how far the camera trails the target. With rate = 8 exponential smoothing the lag is about 33 px and 37 px; a fixed lerp(..., 0.1) gives about 90 px and 19 px, a sign the follow is frame-rate dependent. Then ask the user to run into corners, walls and level edges at low and high frame rates and report any jitter, peeking or snapping.

Patterns

1. Godot 2D built-in follow: smoothing + bounds (don't hand-roll first)

gdscript
# Godot 4.7 Camera2D. Engine-provided smoothing + hard limits + drag margins.
@onready var cam := $Camera2D
func _ready() -> void:
    cam.make_current()
    cam.position_smoothing_enabled = true
    cam.position_smoothing_speed = 6.0           # higher = snappier; lower = floatier
    cam.limit_left = 0; cam.limit_top = 0        # clamp to the level rect (pixels)
    cam.limit_right = level_width; cam.limit_bottom = level_height
    cam.drag_horizontal_enabled = true           # built-in deadzone via drag margins

2. Frame-rate-independent smooth follow (when you hand-roll it)

gdscript
# RIGHT: exponential smoothing — same feel at any FPS. `rate` ~ 5..12.
func _follow(dt: float) -> void:
    var t := 1.0 - exp(-rate * dt)               # converges correctly regardless of dt
    global_position = global_position.lerp(target.global_position, t)
# WRONG: global_position = global_position.lerp(target.global_position, 0.1)
#        → faster smoothing at higher FPS; different feel on every machine.
# Unity 6.3 LTS: Vector3.SmoothDamp(transform.position, target.position, ref vel, smoothTime) in
# LateUpdate gives the same spring behavior with built-in frame-rate correction.

3. Deadzone + look-ahead (lead the player, ignore jitter)

gdscript
# Camera only chases once the target leaves the deadzone box, then aims AHEAD of motion.
func _camera_target(dt: float) -> Vector2:
    var to := target.global_position - _focus
    var dz := deadzone_half_extents                  # e.g. Vector2(48, 32)
    # Only move the focus by the overflow beyond the deadzone (per axis).
    _focus.x += clampf(absf(to.x) - dz.x, 0, INF) * signf(to.x)
    _focus.y += clampf(absf(to.y) - dz.y, 0, INF) * signf(to.y)
    var lead := target.velocity.normalized() * look_ahead_dist    # aim ahead of travel
    return _focus + lead

4. 3D third-person orbit with collision push-in

gdscript
# Godot 4.7. Yaw/pitch a pivot; a SpringArm3D auto-pulls the camera in when blocked.
func _unhandled_input(e):
    if e is InputEventMouseMotion and Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
        # screen_relative is unscaled; `relative` is scaled by the stretch settings, so
        # sensitivity would change with window size. The docs recommend screen_relative
        # for captured-mouse aiming.
        _yaw -= e.screen_relative.x * sensitivity
        _pitch = clampf(_pitch - e.screen_relative.y * sensitivity,
                        deg_to_rad(-80.0), deg_to_rad(45.0))       # clamp pitch!
func _process(_dt):
    pivot.rotation = Vector3(_pitch, _yaw, 0)
    # $SpringArm3D handles wall collision: set spring_length + collision_mask; the child
    # Camera3D slides in automatically. RIGHT: spring arm. WRONG: camera clips through walls.
# Unity 6.3 LTS: a Cinemachine 3 CinemachineCamera (namespace Unity.Cinemachine) with an Orbital
# Follow + Cinemachine Deoccluder; the CinemachineBrain on the Camera blends automatically.

5. Screen shake hook (owned trigger lives in game-feel)

gdscript
# Expose an additive offset the game-feel trauma model writes to; follow + shake compose.
var shake_offset := Vector2.ZERO                 # set each frame by game-feel (trauma^2 * noise)
func _apply(final_focus: Vector2) -> void:
    global_position = final_focus + shake_offset  # shake rides ON TOP of smooth follow
# Unity Cinemachine 3: CinemachineBasicMultiChannelPerlin (AmplitudeGain/FrequencyGain) for
# continuous noise driven by trauma; for one-off impacts, a CinemachineImpulseSource on the
# hitter plus a CinemachineImpulseListener on the camera.

Gotchas

  • lerp(pos, target, const) per frame is frame-rate dependent: floatier at 30 FPS, snappier at 144. Use 1 - exp(-rate * dt) or SmoothDamp.
  • Jitter while following a physics body: the body moves at the physics tick (60 Hz) and the camera at the display rate. Turn on physics interpolation (Godot physics/common/physics_interpolation) and follow the body's interpolated transform in _process (get_global_transform_interpolated() in 3D), or follow in the physics step with Camera2D.process_callback = CAMERA2D_PROCESS_PHYSICS. Mixing the two is what jitters.
  • One-frame lag when following in the normal update before the target has moved. Follow in LateUpdate (Unity) or after movement and physics resolve.
  • Camera parented to the moving player inherits every bump and fights interpolation. Keep the camera on its own branch (or top_level = true) and follow in code or with a rig.
  • Clamping the centre instead of the view shows black past the edge. Clamp to [min + half_view, max - half_view], and centre on any axis where the level is smaller than the view.
  • No deadzone in twitchy games makes the camera twitch with every micro-movement; a box deadzone and a circular one feel different, so pick deliberately.
  • Unclamped pitch flips the camera over the top. About -80° to +45° for an orbit, ±80° for first-person.
  • Mouse-look sensitivity changes with window size in Godot: InputEventMouseMotion.relative is scaled by the stretch settings; read screen_relative for captured-mouse aiming.
  • Clipping through walls in 3D: use a spring arm or occlusion ray, with a probe radius a little larger than the camera's near-plane half-size.
  • Slingshot after teleport or respawn: a smoothed camera whips across the level. Hard-cut and reset the smoothing state (Godot Camera2D.reset_smoothing()), or fast-ease deliberately.
  • Shake written into the follow target makes follow fight shake. Smooth follow first, add the shake offset last.

References

  • references/follow-and-framing.md: read for the smoothing derivation, a full deadzone plus look-ahead plus bounds 2D rig, orbit and first-person details, group framing and split-screen, cutscene blends, and the Godot/Cinemachine 3 component mapping table.

Related skills

  • game-feel: shake trauma and triggers; writes this skill's offset.
  • godot-2d-movement, godot-3d-essentials: the player and world the camera frames.
  • physics-tuning: timestep and interpolation for the bodies being followed.
  • input-systems: look sensitivity, invert and stick response curves.

Version notes

Last verified: 2026-11-11.

Loading package files…

Share this package

Add an Install with AIPM badge

Add this badge to a GitHub README so readers can open the package page and install the same version.

Install with AIPM
[![Install with AIPM](https://www.aipm-registry.com/install-with-aipm.svg)](https://www.aipm-registry.com/skills/gamedev-skills/camera-systems/1.0.0?utm_source=github&utm_medium=readme&utm_campaign=package_badge)

Publisher

gamedev-skills

This imported publisher has not claimed its AIPM account. A connected account confirms account control, but it does not guarantee that a package is safe.

AI assistant context

What this skill is for

@gamedev-skills/camera-systems@1.0.0 is an AIPM skill package for All tools. Use it when a project needs the reusable AI behavior described as: >

Install
aipm add @gamedev-skills/camera-systems@1.0.0
Use after install
/camera-systems <your description>

Tool targets

Install command by target

Add --no-init to any of these when you want the skill files without aipm.package.json or aipm-lock.json.

cursor

Run this variant when you want to install the package into cursor.

aipm add @gamedev-skills/camera-systems@1.0.0 --target cursor --ci

claude

Run this variant when you want to install the package into claude.

aipm add @gamedev-skills/camera-systems@1.0.0 --target claude --ci

Discussion

Comments (0)

Loading comments…

Keep exploring

gamedev-skills/roblox-characters

>

Published by gamedev-skills

skillScanned · no issues★ 10KImported · UnverifiedAll toolsNov 23, 2026, 1:03 AM6.00 KBApache-2.0

gamedev-skills/godot-resources

>

Published by gamedev-skills

skillScanned · no issues★ 10KImported · UnverifiedAll toolsNov 23, 2026, 1:03 AM5.73 KBApache-2.0

gamedev-skills/roguelike

>

Published by gamedev-skills

skillScanned · no issues★ 10KImported · UnverifiedAll toolsNov 23, 2026, 1:03 AM6.85 KBApache-2.0

Package FAQ

Install and compatibility

How to install
Run aipm add @gamedev-skills/camera-systems@1.0.0 in a project that has AIPM initialized.
Supported tools
@gamedev-skills/camera-systems@1.0.0 supports All tools.

Before installing

AIPM skills can add files to your project. Review the package name, target, description, license, and publisher before installing. Use a clean branch when trying a new skill.