Phaser AE

Face where the pointer is

Free packv3.0.0-33DLogic

An object turns to face the spot the pointer lands on in the world, through the full 360°, in front of it or behind it. It is the pointer control a character, a turret or a twin-stick ship needs, and the one that feels right from every camera angle.

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

Released October 14, 2026 · updated October 19, 2026

Face where the pointer is: 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

aim3d

function aim3d(opts: AimOptions = {}): Pack<{ aim: Aim3dApi }>

The aim-3d pack: objects turn to face where the pointer meets the world. Requires a 3D world. Headless, or any step where the pointer resolves to nothing, every object holds its facing.

Types

Aim3dApi

interface Aim3dApi

game.aim.

  • add(h: Handle, opts?: AimOptions): void — Keep h facing the aim point every step. Calling it again re-options it.
  • remove(h: Handle): void — Stop aiming h. It keeps the facing it has.
  • has(h: Handle): boolean — Is h aiming?
  • at: { x: number; y: number; z: number } | null — Aim at this world point instead of the pointer. Set it back to null to follow the pointer again — which is how a game shares one control between mouse and a gamepad-driven cursor or an AI target.
  • readonly point: { x: number; y: number; z: number } | null — Where the pointer last resolved to, or null if it resolved to nothing. Read-only.
  • enabled: boolean — Take the whole pack off and on.
  • readonly count: number — How many objects are aiming.

AimOptions

interface AimOptions

How one object aims.

  • surface?: AimSurface — The surface the pointer resolves onto. 'self' (default) is the horizontal plane through the object, so it aims level at things at its own height; 'ground' is y = 0, for a character walking to the spot under the cursor; 'view' is a sphere range from the camera, which is the only one that can put the point ABOVE the object and so the only one that aims over the full hemisphere.
  • range?: number — How far from the camera the 'view' sphere sits, in world units. Default 20. Ignored otherwise.
  • turnRate?: number — Radians per second the facing may change. Default 0 — snap straight to it. A real character turns: 6 to 10 is brisk, 2 to 3 is heavy. The turn always takes the SHORT way round.
  • tilt?: boolean — Pitch toward the point as well as turning. Defaults to true for 'view', where looking up is the whole point, and false for the flat surfaces, where it would only ever tip a walking character.
  • up?: number — How far it may look UP, radians, as a positive angle. Default π/2 — the full hemisphere. A turret with a mount, or a head on a neck, wants a good deal less. Named for what a person means rather than for the sign: pitch is POSITIVE DOWN in this engine, so up clamps pitch at −up and down clamps it at +down. Every rig here that took minPitch and maxPitch made somebody work that out first.
  • down?: number — How far it may look DOWN, radians, as a positive angle. Default π/2.
  • offset?: number — Added to the computed yaw, radians. Default 0 — for a model built facing something other than +z.
  • deadZone?: number — Hold the facing while the point is nearer than this, in world units. Default 0.05.

AimSurface

type AimSurface = 'self' | 'ground' | 'view'

Which surface the pointer's ray is met with to give it a position — and so how much of the sphere the object can aim over. 'self' and 'ground' are horizontal planes and aim FLAT; 'view' is a sphere around the camera and aims over the full hemisphere, up and down included.