Engine adapters
The adapters put a rigc-built rig inside the engine or renderer your game already uses. Play computes the pose; the host draws it with its own objects.
What it is
Three packages, each versioned on its own, with 0.x APIs. The badge above lists each current npm release; the recording below keeps its original versions:
@rig-c/pixi: a PixiJS 8 adapter.@rig-c/phaser: a Phaser 4.2+ adapter for WebGL scenes.@rig-c/three: a native Three.js 0.186.1 renderer and liveGroup.
Each one reads the model document rigc build writes, skeleton.model.json, through @rig-c/play.
@rig-c/pixi 0.1.1 on PixiJS 8.22.0, @rig-c/phaser 0.1.1 on Phaser 4.2.1 and @rig-c/three 0.1.1 on Three.js 0.186.1. Each panel is the adapters repository's own demo page, run against the npm releases, playing rigc's walk gallery rig and its 0.9 s walk animation; all three read the same skeleton.model.json through @rig-c/play 1.10.0, unmodified. Every frame was posed by seeking each page to the same time (30 fps) and reading its WebGL canvas, and the 0.9 s cycle plays four times. At equal times the panels differ by a mean of 0.03 (PixiJS vs Phaser) and 0.54 (PixiJS vs Three.js) on 0–255 RGB, against 2.4 between neighbouring frames; the Three.js demo draws the rig smaller, so its panel is enlarged more.When to use it
Use an adapter when your game or page already renders with PixiJS, Phaser or Three.js, and the rig must sit in that scene graph with your other objects. Three.js is a 3D renderer, so its adapter is for 2D characters inside 3D scenes and interactive pages.
If you only need a rig in a web page, with no engine, use Play directly. It draws as DOM elements or one canvas. Native engines such as Godot or Unity are planned, not available.
What it solves
rigc compiles a rig into two things side by side: Spine 4.3 skeleton data and its own model document. An official Spine runtime can load the Spine data, but it brings the Spine Runtimes licence with it. An adapter is a third way: rig-c's own poser runs inside the engine's scene graph and renderer, reads the model document, and links no Spine runtime.
What you get
- A live object per host:
PixiRig(a PixiContainer),PhaserRig(a PhaserContainer) andThreeRig(a flat Three.jsGroup). Each owns an independent player and exposesplay,seek,bone()andbounds(). - A renderer per host for when you own the player:
PixiRenderer,PhaserRendererandThreeRenderer. Each draws a suppliedPosedFrame. - Shared page textures: several rigs over one
ModelAssetsload share page textures until the last holder releases them.
How it works
- Load the model with
@rig-c/play'sloadModel, using the filesrigc buildwrote, unmodified. - Create the host object, for example
new PixiRig(assets, { ticker: app.ticker }), and add it to your stage or scene. - Each update,
@rig-c/playposes the rig and produces aPosedFramerecord. - The adapter reads slot corners or mesh vertices, page UVs, tint, blend and clip straight from that record. It maps world
(x, y)to(x, -y)and draws with the host's native objects. - On removal,
destroy()frees that rig's own resources. Dispose the shared assets after the last rig is gone.
npm install @rig-c/pixi pixi.js @rig-c/play
Swap in @rig-c/phaser phaser or @rig-c/three three for the other hosts.
Run a pointer-follow example
The upstream look example is a runnable page: move the pointer to turn the face, with eyes following immediately and the head and body following on a spring. Start with PixiJS below. This route runs locally from a fixed source archive; it needs Bun, curl, tar and a browser with WebGL.
In a new directory:
mkdir rig-c-look
cd rig-c-look
curl -fL https://codeload.github.com/rig-c/adapters/tar.gz/cccc84136c0342312c4d353b46bae9d8c130627f -o source.tar.gz
tar -xzf source.tar.gz --strip-components=1
bun install --frozen-lockfile
cat > look.vite.config.ts <<'EOF'
import { defineConfig, mergeConfig } from 'vite';
import upstream from './vite.config.ts';
export default defineConfig((env) => {
if (typeof upstream !== 'function') throw new Error('Expected the pinned Vite config');
return mergeConfig(upstream(env), {
optimizeDeps: { entries: ['examples/look/index.html'] },
});
});
EOF
BROWSER=none bun run example:look --config look.vite.config.ts --host 127.0.0.1 --port 5173 --strictPort
Open the local PixiJS page. Wait for the loading message to become dial values, then move across the canvas; leaving it returns the target to neutral. Stop the server with Ctrl-C when finished. The committed model and image are already in the archive: no fixture fetch or rebuild is needed. The small Vite config keeps the upstream aliases and helper intact, while limiting dependency scanning to this example; the default config also scans unrelated test/oracle pages whose packages are not installed by this recipe.
What this run uses
The source pin is cccc841; its frozen lockfile selects Play 1.12.0, PixiJS 8.22.0, rig-c 2.64.1 (the public rig-c/core reader) and Vite 6.4.4. The page imports @rig-c/pixi from this checkout's 0.1.2 workspace source, through the upstream Vite development alias. It does not install that adapter from npm. Keep the archive and lock together; the current-release badges above describe a different, build-time lookup.
The fixture directory contains a compiled model and one atlas image used at runtime:
| File | Bytes | SHA-256 |
|---|---|---|
skeleton.model.json | 2,182,604 | 1c2786199210007021fa82874e375a7d29f91e422285ccdf9416caa976585c50 |
skeleton.png | 1,790,672 | d41b70387f1e1f6e988f319c466441f1b0e0dadc731212278113c747ac2cef4e |
The fixture's introduction records a Parts 1.34.0 build on Core 2.59.0, from the project owner's painting, with cylinder-based face turn and slider dials. The committed example and fixture are distributed under the repository's MIT licence; retain that notice when copying them. These are the public bytes this recipe plays, not a new build from the released depth producer. Upstream still marks a refresh to a released public depth rig as pending. Slider motion here does not establish depth-producer acceptance, full 3D rotation or parity between hosts. The separate head-turn preview has its own implementation.
Connect it to your own page
Read the pinned helper, page and host setup together. pointer-dials.ts is example-side TypeScript: import it from the checkout, or copy it with its MIT notice into a bundler-based application. It is not a package export. The upstream page is the complete executable reference; the lifecycle below explains where each piece belongs.
- Load the same model bytes into both readers. Fetch the model URL and check
response.ok. Pass its text toreadModel(text, modelUrl)fromrig-c/core. Pass the same text back toloadModel({ modelUrl, regions: 'none', fetch })from@rig-c/playthrough the public fetch callback, delegating image requests to the browser'sfetch. Keep the model and its image pages together. There is no need to unwrap the opaqueModelAssets.document. - Create the host rig. The PixiJS host creates a
WebGLRenderer, a stageContainerandnew PixiRig(assets, { ticker: null, autoUpdate: false }), fits the rig's bounds and adds it to the stage. With manual stepping there is only one clock. The example'sLookControllerselects the declaredidle, sets the environment and adds its existing calibrated global hair impulse. - Bind declared slider names. For the reusable helper, call
readPointerDialBindings(doc, { yaw: 'yaw_dial', pitch: 'pitch_dial' }), thennew PointerDials(bindings)and assignrig.player.adjust = follow.adjust. Yaw and pitch are required. Addroll,body,gazeXorgazeYonly when your model declares their dial bones and usable sliders. The upstreamLookControllerrequests all six for this fixture, and derives yaw/pitch direction signs from its animation curves; preserve that probe when reusing its fixture. A different rig supplies its own names and directions. - Feed input, then pose and draw. On
pointermove, callpointerToNormalized(event.clientX, event.clientY, canvas.getBoundingClientRect())and pass itsfx, fytofollow.setPointer. CSS coordinates map right/up to positive X/Y and clamp to[-1, 1]; an empty rectangle or nonfinite input maps to zero. Onpointerleave, callfollow.clearPointer(). In each frame, with elapsed secondsdt, callfollow.step(dt)beforerig.advance(dt), thenrenderer.render({ container: stage }). The full upstream page usescontroller.step(dt)to perform that sequence plus its hair input; do not advance the rig a second time. For a touch-controlled application, bind pointer down/move/up/cancel, set the canvas touch policy and clear on release; the pinned example itself only listens to move/leave. - Release in ownership order. Stop your animation frame loop and remove your input listeners. Remove the rig from its stage and call
rig.destroy()beforeassets.dispose(); shared assets stay alive until the last rig releases them. Destroy a renderer only if your page owns it. The upstream page exposeswindow.__lookDemo.dispose(): it cancels its clock, destroys the rig, disposes assets, destroys its host and removes the canvas. It also calls this on non-persistedpagehide; this is the example's inspection API, not a package API.
Each requested dial must have exactly one local, non-looping slider, with finite from/to, nonzero finite scale and a positive animation duration. The helper inverts time = to + (value - from) * scale at time zero and at the duration, then sorts the two endpoints. It preserves asymmetric bands; the raw model's max is not the parsed range. A missing or unsupported slider throws PointerDialRefusal with the axis and bone. Do not replace that refusal with guessed angles or direct head-bone writes.
For these fixture bytes, the derived bands are:
| Axis | Dial bone | Local channel | Band |
|---|---|---|---|
| yaw | yaw_dial | rotation | [-15, 15] |
| pitch | pitch_dial | rotation | [-12, 12] |
| roll | roll_dial | rotation | [-8, 8] |
| body | body_dial | rotation | [-6, 6] |
| gazeX | gaze_x_dial | rotation | [-1, 1] |
| gazeY | gaze_y_dial | rotation | [-1, 1] |
Failures and checks
A missing requested dial produces a console warning and a static rig with the missing axis in the HUD. A failed model fetch sets document.body.dataset.lookReady to error and records window.__lookDemoError; the pinned page leaves its loading text in place. Inspect the console/network and that error value, or add a visible error message and release partially created resources in your application's catch path. Do not treat a loading message as success.
From the extracted repository, bun run test:look exercises the actual helper's reader, refusal, normalization, asymmetric clamp and spring controls without a browser. ?manual=1 disables the page clock for controlled stepping via its inspection API. The reproducible route here is scoped to PixiJS; the upstream host links are available, but no new three-host equivalence or physical touch-device result is claimed.
Key concepts
- Host: the engine or renderer an adapter targets. Each host lives in
packages/<host>. - Model document:
skeleton.model.json, the source the adapters read. Spine is one export of it. PosedFrame: the per-frame record@rig-c/playproduces and every renderer draws.ModelAssets: oneloadModelresult, which several rigs can share.- Parity: an adapter plays the same pose for the same time as
@rig-c/play, held to the player's output by a test.
Go deeper
- Measured runtime costs and unresolved results — historical Play comparisons through the legacy Pixi adapter, with workload and device limits.
- README: Why this exists
- README: What an adapter promises
- packages/pixi README
- packages/phaser README (renderer contract)
- packages/three README (native drawing and scene placement)
- docs/ADDING_A_HOST.md
- Changelogs: pixi, phaser, three
- npm: @rig-c/pixi, @rig-c/phaser, @rig-c/three