Phaser AE

3D Attachments

Free packv3.0.0-23DLogic

Anything that rides something else, a turret on a tank, a weapon in a hand, a light on a lamp post, keeps its place on its parent. And one object can be built from two meshes, a tile and its number, a card and its border, that move, turn and scale as one.

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

Released October 14, 2026 · updated October 19, 2026

3D Attachments: 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.

What it does

game.attach.to(child, parent, offset) gives the child a local pose: a position, yaw, pitch and roll relative to the parent. Each step the whole chain is composed, parents before children in one pass, into the world pose the rest of the engine already understands. Nothing else has to know an object is attached: collision, queries, culling and the renderer see an ordinary object in an ordinary place. Chains nest to any depth.

Scale is not inherited by default, because a crate's size should never inflate whatever rides on it. Turn on inheritScale and the child's scale becomes its own times the parent's, per axis, so a parent stretched tall makes a tall child. Its offset then moves into the parent's units, { y: 1 } meaning one parent-height up, so it stays in place on a parent that resizes instead of sliding off it.

face lays a child on one face of the parent's box, top, bottom, left, right, front or back, centred and turned to face outwards, with lift keeping it a hair clear of the surface so the seam never flickers. Together with inheritScale that is a whole animation layer: tween the parent's position and scale, and the plate on top slides, pops, spins and shrinks with it, with no more code. When a parent dies, its children are left standing where they were, which is what a game usually wants from a destroyed carrier.

Features

  • Local poses — position, yaw, pitch and roll relative to the parent, changed later with offset.
  • Ordinary objects — attached objects collide, cull, query and draw like any other.
  • Chains of any depth — composed parents first in one pass, with a cycle capped rather than hanging the game.
  • Opt-in scale inheritance — per axis, with the offset in the parent's units so it stays put as the parent resizes.
  • Plates on faces — face and lift lay labels, numbers and borders flat on a box without depth flicker.
  • Safe detaching — detach and a parent's death both leave the child where it is in the world.
  • Walk the tree — parentOf, childrenOf and a live count.

Good for

  • Vehicles with turrets and riders — a turret on a tank, a gunner on a jeep, a camera on a mount.
  • Characters holding things — a weapon in a hand, a hat on a head, a lantern on a belt.
  • 3D puzzle tiles — a bevelled tile wearing its number on top, sliding and popping as one, in the style of 2048.
  • Card and board games in 3D — a card and its border, a counter and its symbol.
  • Labelled props — crates, signs and buttons with a plate on a face.
  • Scenes built from parts — lamps with their lights, furniture with its fittings, moving together.

Make it yours

There is nothing to configure when the pack is composed; every choice is per attachment. A rigid rider on a vehicle takes a world-unit offset and no scale inheritance, so the vehicle can grow without stretching its gunner. A puzzle tile takes face: 'top' and inheritScale: true, so a single tween of the tile's scale pops its number too. A turret whose base turns flat while its barrel elevates is two objects, the barrel attached to the base.

A quick look

A tile with its number on top, animated by tweening only the tile:

const body = game.world3d.spawn({ mesh: 'roundedBox',   sx: 0.96, sy: 0.26, sz: 0.96, color: tint });
const face = game.world3d.spawn({ mesh: 'roundedPlane', texture: 'nums', textureFrame: n });
game.attach.to(face, body, { face: 'top', inheritScale: true });

game.tween.to(body, { x, z }, { duration: 0.13 });                                // slide
game.tween.to(body, { sx: 1.15, sy: 1.15, sz: 1.15 }, { yoyo: true, loop: 1 });  // merge pop

Works with

  • core-3d — includes it, so most 3D games have it already.
  • world-3d — required; the objects it attaches.
  • tween — animate the parent and the whole assembly follows.
  • aim-3d — a turret base and barrel that aim separately while staying joined.
  • model-files-3d — for a loaded model whose parts already share an origin and move together without this.

Good to know

  • Chains compose on the fixed step, so a very fast parent can show a hair of separation between steps.
  • There is no attaching to an individual bone or part of a model yet.
  • face uses the parent's bounding box, which suits a label on a crate but not a sticker on a ball.
  • Scale inheritance multiplies scales and does not shear, so a child rotated inside a stretched parent scales along its own axes.

More Logic packs

Show all →