Phaser AE

Drag to spin an object

Free packv3.0.0-33DLogic

Drag an object to turn it, flick it to keep it spinning, snap it to a facing. The camera stays where the shot was framed and the subject turns under the player's hand.

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

Released October 14, 2026 · updated October 19, 2026

Drag to spin an object: 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

Set game.turntable.target to an object and the pack turns it as the player drags: yaw for side-to-side movement and, with tilt on, pitch for up and down. The direction comes from the kernel's dragToSpin, shared with every other 3D control, so drag right turns the object right and it cannot be wired backwards here on its own.

The flick is the part games get wrong. Letting go should let the object carry on and slow down, but taking the last frame's movement as the throw throws nothing most of the time, because a hand usually stops for a frame or two before it lifts. The velocity here is averaged over a short window, so a flick that ends in a pause still flicks, while a deliberate pause still places the object without flinging it. With snap set, it settles on the facing the coast would have reached, so a hard flick moves on by a facing instead of springing back.

It is not an orbit camera, though the picture looks the same: an orbit camera circles a still subject, while a turntable turns the subject, so a lit set and a backdrop stay still around it. Nor is it an aim control; for an object that should face the cursor, use aim-3d.

Features

  • Drag to turn and tilt — sensitivity in radians per pixel, with tilt held between minPitch and maxPitch short of vertical.
  • A flick that works — throw velocity averaged over a short window, coasting down over inertia seconds.
  • Snapping — to snap equally spaced facings, settling in snapTime, on the facing the flick aimed at.
  • Idle spin — autoSpin radians a second, resuming after autoDelay seconds without input.
  • Live state — yaw, pitch, dragging, coasting and enabled, and reset to ease back to square on.

Good for

  • Character select screens, turning the chosen hero on the spot.
  • Model and product viewers where the subject spins and the lighting stays put.
  • Trophy rooms and collectibles on a plinth, with a slow idle spin.
  • Objects to inspect in a puzzle or adventure game, snapping to each face in turn.

Make it yours

The options are sensitivity (0.01), inertia (0.7 seconds), tilt (on), minPitch and maxPitch (-1.2 and 1.2), autoSpin (off), autoDelay (2 seconds), snap (off), snapTime (0.25 seconds) and enabled. Two different uses: a showroom with free spin, a long coast and a slow idle spin that comes back two seconds after the player lets go; and a character select with tilt off and snap: 4, so however hard the player flicks, the hero comes to rest square on to the front, a side or the back.

A quick look

A model to spin, an idle turn, and a reset:

game.turntable.target = model;      // what spins; null parks the control
game.turntable.autoSpin = 0.3;      // idle spin, radians a second
game.turntable.reset();             // ease back to square on

Works with

  • rig-orbit — when the camera should circle and explore a scene instead.
  • aim-3d — when an object should face the pointer rather than spin.
  • attach-3d — to spin several things as one group.
  • core-3d — the 3D world it needs.

Good to know

  • One target at a time.
  • It writes yaw and pitch on the object every step, so a tween or a physics body driving them is in a fight; park it with enabled = false while something else is in charge.
  • It reads the first pointer anywhere on screen, so switch it off while the pointer is over a panel beside the viewer.
  • It needs a 3D world, and headless it does nothing.

More Logic packs

Show all →