Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

camera-systems

БесплатноБез исполняемых скриптовНе проверен

Builds and tunes game cameras, engine-neutral with Godot and Cinemachine 3 mappings: 2D follow with deadzone and look-ahead, third-person orbit, first-person…

gamedev-skillsот gamedev-skills★ 12 656 звёзд на GitHub

Об этом скилле

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)

# 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)

# 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)

# 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

# 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.
Полный SKILL.md на GitHub

Установить camera-systems в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/follow-and-framing.md

FAQ

Что делает скилл camera-systems?

Builds and tunes game cameras, engine-neutral with Godot and Cinemachine 3 mappings: 2D follow with deadzone and look-ahead, third-person orbit, first-person look and split-screen. Use when the camera lags, jitters while following, shows past the level edge, clips through walls or changes with frame rate. Not for shake (`game-feel`) or physics timestep jitter (`physics-tuning`).

Как установить скилл camera-systems?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл camera-systems запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить camera-systems с