Phaser AE

Follow camera

Free packv3.0.0-32DRigs

The camera for any 2D game whose world is bigger than the screen. Point it at the player, or at several players, and it follows with the deadzone, smoothing, look-ahead and bounds that make scrolling feel deliberate rather than mechanical.

This is a Free pack. Every phaser.io account can use it in their games.

Released October 14, 2026 · updated October 19, 2026

Follow camera: a screenshot of its demo
A note about these graphics

Expansion packs don't come with graphics. This screenshot is one way of drawing what the pack does, made for its demo: none of the sprites, tiles or backgrounds in it are in the pack.

That's by design. A pack is a game's logic, mechanics and effects, and it works with whatever art you give it. Some packs draw effects, backdrops or 3D scenes of their own, but none carries a game's sprites.

So the look is yours. Make the art on phaser.io, bring your own, or let your agent draw it in code: the same pack can look like anything.

The pack

follow

function follow(opts: FollowOptions = {}): Pack<{ rig: RigApi }>

The follow-camera rig pack. Moves the camera after physics-2d (rig-follow.camera step) towards the followed object or objects, with a deadzone, smoothing, an offset, look-ahead, zoom-to-fit, bounds and a cut on teleport, and returns rig. Requires a 2D world.

Types

FitOptions

interface FitOptions

Zoom-to-fit: while following several objects, zoom so they all stay in view.

  • padding?: number — World units kept clear between the outermost target and the view's edge. Default 48.
  • minZoom?: number — The furthest out the camera zooms, however far apart the targets are. Default 0.25.
  • maxZoom?: number — The furthest in it zooms, however close together they are. Default 1.

FollowOptions

interface FollowOptions

Manifest options.

  • deadzone?: number | { w: number; h: number } — The box the target may roam in before the camera moves, world units: a number is a square half-size, { w, h } a full rectangle. Default 0.
  • smoothing?: number — Fraction of the gap closed per fixed step, 0 locked to 1 instant. Default 0.15.
  • offset?: { x: number; y: number } — World units from the target to the framed point. Default { x: 0, y: 0 }.
  • lookAhead?: number — Seconds of the target's motion to lead by. Default 0.
  • snapDistance?: number — The one-step jump, world units, treated as a teleport. Default 256; 0 never cuts.
  • fit?: FitOptions — Zoom so several followed objects stay in view. Default off.

RigApi

interface RigApi

game.rig: the follow camera.

  • follow(h: Handle | readonly Handle[] | null): void — Track this object, or several (the camera frames the middle of them); null stops. Scene-scoped: cleared when the scene exits. A jump over snapDistance in one step cuts the camera instead of sweeping it.
  • readonly target: Handle | null — The first followed object, or null.
  • readonly targets: readonly Handle[] — Every followed object.
  • deadzone: number | { w: number; h: number } — The box around the screen centre the target may move in before the camera follows: a number is a square half-size, { w, h } a full rectangle.
  • smoothing: number — 0 = locked, 1 = instant. Per-step smoothing: the camera closes a fraction of the gap each step, so it speeds up to catch a moving target and eases to a stop behind one that stopped. Zoom-to-fit eases at the same rate.
  • offset: { x: number; y: number } — World units from the target to the point the camera frames: { x: 0, y: -40 } keeps a platformer's hero below the centre.
  • lookAhead: number — Seconds of the target's motion the camera leads by: it looks where the target is going. 0 is none.
  • snapDistance: number — A target that moves further than this in one step has teleported (a respawn, a wrap): the camera cuts with it. 0 never cuts.
  • fit: FitOptions | null — Zoom-to-fit for several targets, or null to leave the zoom alone.
  • bounds(rect: { x: number; y: number; w: number; h: number } | null): void — Clamp the camera so the view never leaves this rect (a tilemap's bounds()). Scene-scoped. null clears. A rect smaller than the view centres on it.