# Rig mapping and animation authoring

Read this before creating a new Rig, remapping a clone, or authoring a character clip. These instructions describe the actual renderer contract, not a reusable human skeleton template.

For new Models follow [API v2 atlas-only assets](atlas-v2.md). V2 Parts store atlas `rect` and optional RLE mask instead of crop `src`; crop image examples below are the legacy v1 contract. Keep legacy Models/Clones on their existing asset version and select their API prefix accordingly.

## End-to-end New Model sequence

1. Complete [Model creation questions](project-intake.md): resolve New versus Clone and collect the requested parameters before creation. For New, use the agreed 1–8 directions and inspect the provided artwork; do not choose the mode or view set solely from a supplied atlas.
   If there is only Concept Art or a requested direction lacks separated parts, first follow [Concept Art to direction parts](concept-to-directions.md). Preserve the original with the model and generate the target-view atlas before measuring its joints.
2. POST `/api/v2/models` with a fresh empty `custom-rig`. A valid initial body is:

```json
{"name":"New character","config":{"format":"pixat-parts-rig","version":2,"assetVersion":2,"modelType":"custom-rig","selectedDirection":2,"selectedDirectionKey":"right","customNodes":[],"customPaths":[],"configurations":{"custom-rig":{}}}}
```

3. Save the returned ID and revision and immediately open `/studio-agent/{id}` in a visible browser. Keep this preview open throughout subsequent API edits; click its header ↻ button once after every successful API save; do not poll revisions or replace a user's unsaved draft. PUT the original image bytes to `/api/v2/models/{id}/atlas/right` with that revision. Record the new revision returned by the upload. Uploading an atlas does **not** create custom Nodes, Paths, crops or anatomical mappings automatically. Never claim rigging is complete after upload alone.
4. Check anatomical part boundaries before measuring: the torso reaches each shoulder socket, moving sleeves/upper arms belong to the arms, and each piece begins/ends at its matching attachment. Correct duplicated visible anatomy or incomplete joint ends in the artwork first. Apply **Invisible attachment seams** in [Concept Art to direction parts](concept-to-directions.md): attachment pixels continue the adjacent clothing/skin/surface material without exposed puppet joints or contrasting cut edges. Review assembled Bind and requested motion with overlays off; retain structural Nodes and editor guides. Measure each crop, joints and shared attachments. Build all `customNodes`, `customPaths`, and that direction's `parts`, `rig`, `rigScale`, `parents`, `frame`, and layer order. PUT the full config with the latest revision. Preserve unknown config fields and other configured directions. GET the model and `/animations` and verify the saved result before animating.
5. PUT named clips per direction through `/animations/{direction}/clips`. For an authored running cycle use `clips.run`, even though the UI also has a built-in Run label. Custom rigs have no automatic human walk/run motion; `/run` writes static preset overrides, **not** running keyframes.
6. Reread model and animation data, then open `/studio-agent/{id}` to check the saved result. Read [Studio Agent preview guide](studio-agent-commands.md), compare Bind and animation with bone overlays using URL parameters, play a complete loop and inspect requested exports through a supported export workflow. After API saves, refresh the visible Studio Agent once with its header button; do not poll revisions. If browser access is unavailable, explicitly label visual quality as unverified. Normal Studio remains separate; there is no `?mode=agent` or command console.

## Coordinate and topology contract

The same Node ID has one bind coordinate in `rig` and may appear in several part-local `bones` maps. Do not create a separate animation skeleton.

| Field | Meaning |
| --- | --- |
| `customNodes[].parent` | Anatomical parent; `null` for the root. Parent-first order is recommended; API canonicalizes valid graphs. |
| `pathId` | Exactly one owning image Path for that Node. Shared attachments retain this owner. |
| `beforeNode` | Next Node along the owning Path's main chain; `null` at its end. Does not replace `parent`. |
| `branch` | True for an attachment branching from the main chain, e.g. shoulder off chest. |
| `customPaths[].connections` | Two existing, distinct endpoint IDs, in chain order. |
| `connectionPaths` | Corresponding endpoint owners, by index; torso-owned shoulder uses torso Path here. |
| `parts[pathId].pathNodeOrder` | Ordered main deformation chain from first endpoint to second. Each adjacent Node's parent is the preceding Node. Do not insert shoulder/hip branches into the torso's spine chain. |
| `bones` | Pixel positions relative to that crop's top-left; include the main chain **and every Node owned by the Path**, including branch attachments. |
| `rig` | Bind positions in animation-canvas pixels, top-left origin, +x right, +y down. Every Node needs a finite position in each configured direction. |
| `parents` | Direction map that agrees with `customNodes[].parent`; topology is shared across directions. |
| `rigScale` | Uniform source-pixel-to-canvas-pixel scale for that direction's pieces. Derive it from artwork dimensions, fit the assembled character into the frame, and preserve proportions. |
| `frame` | `{width,height,x,y}` export frame and camera offset in canvas pixels. |
| `layerOrder` | Top-level array of eight arrays in compass-key order; each is front-to-back Path IDs. Near/far layers depend on artwork/view. |

For each part save `src` as the actual cropped PNG/WebP data URL, `width`, `height`, `rect: {x,y,w,h}` in atlas pixels, `pivot: {x,y}` at its local attachment, `offset: {x:0,y:0}`, `bones`, `skin` and `pathNodeOrder`. Width/height must match the encoded crop. `skin` is a map of internal bend IDs to influence radii in source pixels. Keep original alpha. Use zero `offset` for measured bind mappings: a nonzero offset deliberately moves artwork away from the Rig and must not compensate for an incorrectly measured joint. An atlas filename or URL is not a replacement for each mapped crop's `src`.

### Check part boundaries before placing Nodes

Read **Match part boundaries to their attachment joints** in [Concept Art to direction parts](concept-to-directions.md), including when the user supplies an already separated atlas. Storage crop rectangles and anatomical cut lines are different: use the part's alpha silhouette to isolate its assigned surfaces. Keep the torso complete to its shoulder attachments, while the independently moving arm owns the shoulder cap/sleeve through the hand. The torso may own the shared shoulder Node without owning upper-arm pixels. Use limited concealed overlap at the pivot, not a second visible sleeve or arm stump. Apply the same principle to neck, hip and other part connections.

Inspect the torso and limbs separately, then assemble Bind at the shared pivots. Fix missing attachment coverage, doubled outlines or body surfaces assigned to the wrong Path before authoring motion. A bone offset, Node drag or layer change cannot remove a stationary arm painted into the torso. If supplied artwork needs correction beyond the requested mapping work, explain the specific asset correction needed rather than silently redesigning it.

### Example: torso branch shared by an arm

This illustrates data relationships only; measure coordinates from the actual image. With `path-torso` connections pelvis→neck, its main chain is pelvis→chest→neck. A torso-owned shoulder branches from chest. The arm's main chain is shoulder→elbow→wrist.

```json
{"customPaths":[
 {"id":"path-torso","name":"Torso","connections":["node-pelvis","node-neck"],"connectionPaths":["path-torso","path-torso"]},
 {"id":"path-arms","name":"Arm","connections":["node-shoulder","node-wrist"],"connectionPaths":["path-torso","path-arms"]}
],"customNodes":[
 {"id":"node-pelvis","pathId":"path-torso","name":"Pelvis","parent":null,"beforeNode":null,"branch":false,"ratio":0.5},
 {"id":"node-chest","pathId":"path-torso","name":"Chest","parent":"node-pelvis","beforeNode":"node-neck","branch":false,"ratio":0.5},
 {"id":"node-neck","pathId":"path-torso","name":"Neck","parent":"node-chest","beforeNode":null,"branch":false,"ratio":0.5},
 {"id":"node-shoulder","pathId":"path-torso","name":"Shoulder","parent":"node-chest","beforeNode":null,"branch":true,"ratio":0.5},
 {"id":"node-elbow","pathId":"path-arms","name":"Elbow","parent":"node-shoulder","beforeNode":"node-wrist","branch":false,"ratio":0.5},
 {"id":"node-wrist","pathId":"path-arms","name":"Wrist","parent":"node-elbow","beforeNode":null,"branch":false,"ratio":0.5}
]}
```

The torso's `bones` contains pelvis, chest, neck **and shoulder**, while its `pathNodeOrder` contains only pelvis, chest, neck. The arm's `bones` and `pathNodeOrder` both contain shoulder, elbow, wrist. The shoulder's crop-local coordinates differ between images; its single `rig.node-shoulder` position aligns both. The same rule applies to hips, neck and equipment attachments.

### Calculate bind positions

Choose one root canvas coordinate and a uniform scale `s`. For a source parent-child pair on the same crop:

`rig[child] = rig[parent] + s * (bones[child] - bones[parent])`

Start a detached piece from its shared attachment's already-known canvas coordinate. Repeat along its chain. Map torso-owned shoulder/hip branches using their measured torso-local deltas. Verify every mapped edge has the same vector and length as the scaled local edge in Bind. Do not subtract atlas `rect.x/y` twice: `bones` is already crop-local. Do not copy coordinates across directions.

### Keyframes are local transforms, not new joint positions

For every rendered pose, Node `n` parented to `p` uses planar Z rotation:

```
localOffset = bind[n] - bind[p] + {x:n.x, y:n.y}
posed[n] = posed[p] + rotate(worldAngle[p], localOffset * worldScale[p])
worldAngle[n] = worldAngle[p] + n.rotation
worldScale[n] = worldScale[p] * {scaleX:n.scaleX, scaleY:n.scaleY}
```

A root uses `posed[root] = bind[root] + {x,y}`. Positive rotation is clockwise in this +y-down canvas. Rotating a Node rotates its outgoing bone and descendants around that Node; it does not translate that Node itself. Example: bind shoulder(100,100), elbow(100,140), wrist(100,180); shoulder rotation +90° places elbow(60,100), wrist(20,100). Elbow rotation then bends elbow→wrist. To bend the knee, rotate knee, not ankle. Terminal Nodes without children cannot bend an outgoing bone.

Rotation is Z-only through `rotation`. Do not author `rotationX/rotationY`; legacy values are ignored in the shared renderer. Read [Z-only rotation and projected movement](depth-rotation.md). Use parent-local translation and positive scale for projected foot lift and view-specific pose/contact adjustments. Saved layer order applies to every Path; X/Y angles never change drawing order.

Use ordinary per-Node rotations (e.g. normalized −180..180) and interpolate the shortest arc. For motion within the viewing plane, flexion is measured between posed segments, including the bind bend, rather than simply the raw knee `rotation`. With motion into depth, the angle between projected 2D segments does not establish the anatomical 3D flexion. Evaluate the hierarchy and intended anatomical pose when checking limits or solving foot contact. IK or a 3D pose projected to 2D may be calculated offline; PIXAT receives the resulting keyframes and does not simulate physics.

## Smooth running cycle and acceptance checks

For the reproducible generation recipe, read [Reproduce a smooth running cycle](run-cycle.md): measured roles, phase/contact targets, two-bone IK, local-rotation conversion, calibrated body motion, API persistence and visual iteration. Its humanoid side-view numbers must be adapted to the current artwork and direction.

An example cadence is 24 sampled poses at 30 FPS: frames 0–23 plus frame 24 copied exactly from frame 0 as the closing key. The cycle lasts 0.8 s. Preview and export omit that duplicate closing sample; when 0 and 24 differ, all 25 samples play. An explicit clip `frameCount` takes precedence: set it to 12 to play samples 0–11, with an optional matching closing key at 12 for interpolation. Keys beyond 12 are preserved but excluded from the active clip. Without an explicit count, for shorter clips apply the same rule to the actual final authored frame N: N samples if its transforms match frame 0, otherwise N+1. The 24-frame editor limit does not extend shorter clips with a hold. Only use identical endpoints for a looping action; dying/jumping may be non-looping in intent, but Studio playback currently repeats clips.

Author all body Nodes on every sample, starting from neutral transforms and applying purposeful rotation, translation and scale according to the viewing direction below. Use coordinated motion for the spine/head, hips, knees, ankles, shoulders, elbows and wrists. Equipment inherits its host; do not add gear wiggle.

- Alternate legs by half a cycle and swing the opposite arm forward. Running has push-off, flight and landing; do not merely speed up a walking pose.
- Keep the supporting foot at a consistent ground height during stance. For an in-place run, it moves backward relative to the root as the character would advance. Lift the swing foot, flex its knee in the natural direction and recover it for landing. Counter-rotate the ankle to control the sole pitch.
- Check intended knee flexion and its anatomical direction at every sample and between keys. Use the human guardrails below for humanoids; derive different limits for other species. For planar side-view IK, keep segment lengths invariant and revise unreachable targets. For depth motion, allow projected 2D lengths to change with foreshortening; a shorter projected shin or translated knee can represent a valid anatomical pose.
- Coordinate modest pelvis/spine rotation and stabilized head motion with arms/legs. Each body piece must participate through its parent or purposeful local motion. Avoid artificial noise to make every local transform nonzero.
- Check endpoint positions and near/far layer order. No detached shoulder, floating hip, orphan Node or reversed knee. Inspect silhouettes and source proportions; numerical validation alone cannot establish natural-looking motion.
- Compare frame 23→24(0) with other adjacent steps: both pose and velocity should join smoothly. Identical endpoints alone do not guarantee a smooth seam. Reduce jumps or abruptly reversing foot/hand trajectories.
- Record cycle duration, actual sampled frames, joint bend range/sign when measurable, maximum attachment mismatch, stance foot height drift, projected-length changes and loop discontinuities. Separate intended foreshortening from accidental stretching. Inspect the rendered loop and Sprite Sheet when authorized, and iterate poses until motion and image deformation agree. Report only the views and actions actually checked.

## Rig mapping from scratch

Treat rigging and image mapping as two linked sets of coordinates. `rig` stores each joint's position on the animation canvas; `parts[pathId].bones` stores the same joint's position inside that cropped image piece. They must use the exact same Node IDs and be measured in their respective coordinate spaces.

Treat the Rig's displayed bone lines as a 2D projection of the character's real skeleton. Put each Node center on its actual anatomical joint or attachment pivot, and draw each parent-child edge along the anatomical bone axis between adjacent joints (for example, shoulder → elbow → wrist, or hip → knee → ankle). Do not draw a line through a whole limb while skipping a real intermediate joint, connect unrelated joints, or align the skeleton to decorative marks or convenient image coordinates. Use the selected direction's visible silhouette and anatomy to model joint positions into that view; the same logical joints keep their IDs across directions, but their 2D coordinates change with the view. These Rig edges describe skeletal structure. A `customPath` describes the Node chain used to deform one image piece: keep its chain on that piece and connect its endpoints to the correct attachment pivots rather than using it to join separate body regions.

**Connection point** means the single anatomical pivot or attachment where two independently mapped image pieces meet and should move together at that joint. It is a shared Rig Node, not simply a crop corner, overlapping decoration, or any arbitrary point where two images happen to touch. Put that same Node ID in both pieces' local bone maps; include it in the adjoining limb chain while keeping torso-owned attachments as branches off the spine chain, and give it one canvas-space `rig` position per direction. If the joint is covered by fur, clothing, scales, or another overlapping piece, infer its position from the underlying anatomy and the adjoining pieces' centerlines; keep the local crop coordinates distinct while making their projected canvas positions coincide.

### Connect image pieces at shared joints

- Map each independently moving image piece as its own `customPath`, then identify the anatomical articulations that connect neighboring pieces. The piece boundary may not line up with the joint, and some pieces may overlap; place the connection at the real pivot/contact point, not merely at the nearest crop edge.
- Create one logical Node ID for each anatomical joint. Reuse that same ID as the endpoint on every adjacent piece that meets at the joint; do not make duplicate Nodes for the two sides of one joint. The shared Node has one `rig[nodeId]` canvas position per direction, so all attached pieces meet at exactly the same point in the assembled preview.
- In each piece's `customPath.connections`, list its two endpoint Node IDs in chain order. When an endpoint Node is owned by another Path (`customNodes[].pathId`), set the corresponding `connectionPaths` entry to that owning Path ID. Use the endpoint's own Path ID when that piece owns the Node. The two `connectionPaths` entries correspond by index to `connections`.
- Include each endpoint Node in that piece's `parts[pathId].bones` and `pathNodeOrder`, even when an adjacent Path owns the Node. Measure the shared joint separately inside each crop: crop-local coordinates may differ, but after crop offsets and assembly transforms they must coincide with the single canvas-space Rig position.
- Set `parent` links along the actual anatomical hierarchy, not by image crop ownership. A piece boundary does not create a new joint or break the parent chain. Check both pieces at every shared joint in the assembled preview before creating animation.

For a humanoid or human-proportioned character with a torso and separate limbs, make the torso Path own the anatomical left and right shoulder attachment Nodes and the left and right hip attachment Nodes. Put these Nodes in the torso crop's `bones` at the actual pivots. Each arm Path uses the matching shoulder Node as its torso-side endpoint; each leg Path uses the matching hip Node. Set those endpoints' `connectionPaths` to the torso Path, and include the same endpoint IDs in both torso and limb crop-local maps. Keep left/right in the character's anatomical sense, not as fixed screen-left/screen-right labels. Do not impose this four-attachment template on a creature with different anatomy.

For non-human or fantasy creatures, derive the Node graph from that creature's anatomy and intended articulation; do not start from a human skeleton and rename its Nodes. For example, a dragon may need head–neck, neck–torso, wing-root and wing-joint, forelimb, hindlimb, and tail-base/segment connections. An elephant may need shoulder/hip limb pivots plus a flexible trunk-root and trunk-bend chain; only add ear or tusk Nodes if those pieces move independently or need explicit attachment mapping. Use one shared Node ID at each real connection between pieces, and add bend Nodes along continuous flexible parts where their motion requires them. Keep each limb's, wing's, trunk's, or tail's parent chain anatomically connected, and omit joints that the creature or artwork does not have.

### Attach weapons, armor, and wearable equipment

- Treat each equipment image as a mapped Path. First identify how it is worn or held and which body surface or joint actually supports it. Define the attachment at that contact/grip pivot, not at the equipment image's center or crop edge. Reuse the body's Node ID when equipment attaches at an existing body joint; add an equipment-specific Node only when the artwork has a distinct pivot or articulation.
- For a one-handed weapon, align the grip point to the hand Node; use the wrist/hand axis to orient the weapon. For a two-handed weapon, attach the primary grip to one hand and map a secondary contact for checking the support hand. The Rig is a single-parent tree: it does not enforce a two-hand constraint automatically. Author the supporting arm poses so its hand stays on that grip; do not give one Node two parents. Attach a shield at its handle/forearm contact. Attach a helmet to the head/neck interface, shoulder armor to the shoulder, a chest piece to torso anchors, gloves to wrist/hand, boots to ankle/foot, and a backpack or harness to its actual back/strap contact points. These are examples, not mandatory slots; follow the supplied character and equipment art.
- For rigid equipment with multiple supports, use the main attachment plus additional branch Nodes at the real secondary contacts. Use a single primary host parent for the equipment, then check secondary contacts against the other body Nodes during motion; the renderer does not solve multi-parent rigid constraints. Add extra Nodes for flexible straps, cloth, or hanging gear only when needed to map a real attachment point or when the user requests separate articulation. Keep the equipment's attachment Node IDs and body Node IDs aligned in the shared Rig; include each anchor in the equipment crop's local `bones` at the correct grip/contact pixel and connect its Path to the owning body Path with `connectionPaths` where required.
- Connect each equipment Path accurately to the supporting body Node(s), with the correct local anchor coordinates and per-direction canvas positions. By default, let weapons, armor, and wearables inherit movement from the hand, torso, head, or other body part they attach to; do not author separate equipment motion, sway, or physics. Animate an equipment piece independently only when the user specifically requests it or its image contains an independently articulated part.
- Check attachment alignment and layer order in each configured direction so the equipment remains connected to its host and appears in front of or behind the body as intended. Focus on correct Node connections; do not add gear-only motion to satisfy the character-animation requirement that body parts move.
- Recalculate each attachment's canvas position from the character-and-equipment composition for every configured direction. Preserve logical attachment identities, but allow their projected positions and visible near/far ordering to change by view. If no equipment artwork or wear/hold instruction identifies the intended contact, ask for that information instead of guessing.
- This API supports mapping equipment imagery and its Nodes into a model Rig. It does not define inventory slots, equip/unequip state, or a runtime equipment system; do not claim that mapping a gear Path implements those features.

Recalculate each attachment's `rig` `{x,y}` for every configured direction from that direction's artwork and body orientation. Do not copy front-view positions into side, diagonal, or back views, or mirror coordinates blindly. Preserve the same anatomical Node IDs across directions; allow their screen positions to shift or overlap when the projection puts joints together. For every direction, verify both endpoints at each piece connection resolve to the same canvas coordinate and lie on the visible piece boundary or inferred pivot for that view.

Example: the torso owns `node-shoulder`; an arm Path connects `node-shoulder` to `node-wrist` and has `connectionPaths: ["path-torso", "path-arm"]`. The arm crop's `bones` contains `node-shoulder`, `node-elbow`, and `node-wrist`; the torso crop also contains `node-shoulder` at its own crop-local coordinate. Both parts use the same `rig.node-shoulder` canvas position. `node-elbow` is parented to `node-shoulder`, then `node-wrist` follows it. This connects the artwork at the shoulder without duplicating the joint.

1. **Inspect each selected direction's atlas.** Record the atlas dimensions and identify the independently moving image pieces. Create one `customPath` per piece that should deform independently. Keep each crop's original pixels and transparency; do not invent hidden body parts or assume the six-piece Basic Human layout.
2. **Design the skeleton topology from real articulation points in the artwork.** Identify the character's actual joint centers and attachment pivots (for example, neck, shoulder, elbow, wrist, hip, knee, ankle, and toe when those joints exist in the character). Place each Node at the anatomical point where the connected pieces pivot or meet, based on the source pixels. Do not place Nodes at arbitrary evenly spaced positions or at nearby visual landmarks such as an eye, hair detail, or clothing decoration. Add an internal Node only for a real joint or bend that the rig needs to articulate; do not invent joints just to add detail. Name Nodes for their joint role, then assign stable lowercase IDs matching `node-[0-9a-z-]{4,40}`. Every Node belongs to a `pathId`. Each image Path has two endpoint IDs in `connections`; both endpoint Nodes must also be present in `customNodes`. Root Nodes use `parent: null`. For a chain, set each internal Node's `parent` to its preceding Node and `beforeNode` to the next Node in the chain. Order Nodes parent-first. Use additional branch Nodes only when the artwork requires them.
3. **Map each crop locally.** Under `configurations.custom-rig[direction].parts[pathId]`, store the cropped image and its dimensions, `pivot`, `offset`, `rect`, `bones`, `skin`, and ordered `pathNodeOrder`. In `bones`, put every Node on that Path at its measured pixel coordinate relative to the crop's top-left corner. Path endpoints must land on the actual joint/attachment pivots at the piece boundaries; internal Nodes must land on the corresponding real bend or joint center visible in that piece. If a joint is partly hidden, infer its pivot from the adjoining limb contours and anatomy, and avoid pretending the estimate is exact. Keep transparent margins and crop offsets consistent with the source atlas.
4. **Place the same skeleton on the animation canvas.** In `configurations.custom-rig[direction].rig`, store an `{x, y}` canvas-pixel position for every custom Node used by that direction. Each canvas Node must mark the same real joint as its matching crop-local `bones` Node after the crop offset and assembly transform are applied. The origin is the canvas's top-left; coordinates must fit the configured frame. Store the direction's `parents` map too, matching the Node hierarchy and using `null` for roots. Reuse the same logical Node IDs and topology across views, but measure positions separately for each selected direction; never copy one view's coordinates blindly to another.
5. **Check the whole mapping before animating.** Confirm that every Path endpoint resolves to a custom Node at the correct anatomical attachment, every custom Node has a valid Path and parent, each mapped part's `bones` includes every Node in its `pathNodeOrder`, and every configured direction has a Rig position for each Node. Compare each full-canvas joint against the corresponding crop-local joint and assembled artwork; their pivots must coincide. Reject arbitrary/off-joint placements, stale Basic Human IDs, duplicate IDs, missing image crops, broken parent references, and parent cycles. Save the config, reread the model, then read `/api/models/{id}/animations`; its `nodeIds` must contain the custom Nodes and no Basic Human Nodes. Fix mapping errors before writing keyframes.

Example for an arm image Path: the Node order is `node-shoulder` → `node-elbow` → `node-wrist`, following the arm's anatomical centerline. The Rig draws two adjacent bone edges, shoulder-to-elbow and elbow-to-wrist. `customPaths[].connections` is `["node-shoulder","node-wrist"]`; `customNodes` contains all three Nodes, with the elbow's `parent: "node-shoulder"` and `beforeNode: "node-wrist"`. The part-local `bones` positions are measured inside the arm crop, while the direction's `rig` positions are measured on the full animation canvas. They are different coordinates for the same Nodes.

For each leg, use the anatomical chain `hip` → `knee` → `ankle` → `foot` → `toe`, placing the hip at the pelvis-to-leg pivot, the knee at the bend, the ankle at the shin-to-foot joint, the foot Node around the midfoot, and the toe Node near the boot tip. Draw a separate bone edge between each adjacent pair. For a simple or rigid foot that does not need its own bend, the midfoot Node may be omitted; keep at least `hip` → `knee` → `ankle` → `toe` when the artwork supports those landmarks. Apply the same logical chain to left and right legs, with independently measured coordinates for each direction.

The API recognizes eight direction keys. It does not yet define a separate enabled-direction count field, so asking for 1–8 directions guides which directions the Skill sets up but does not make Studio hide or disable the remaining compass directions. Do not claim that a direction-count setting is persisted in the UI until that config field exists.

When the user asks to clone one of their own models, call `POST /api/models/{id}/clone` with the source revision in `If-Match`; this creates an independent Draft with copied model data, animation, and image assets. To copy someone else's published work, use `POST /api/models/{id}/copy` from a signed-in account session; the owner must enable `copyTemplate`, and no payment is involved. Never clone another owner's model through the owner-only clone route.

Creating or cloning a Model consumes one monthly subscription Model slot. Uploads and browser edits have no credit debit; successful external API calls consume requests. Check /api/subscription without metering and retain ownership/revision protection. Export saves browser drafts without changing visibility or locking content. Only Public allows nonowner viewing; Clone permission remains configurable. Do not add marketplace prices or resale settings.

### Choose transforms for the viewing direction

- Use `rotation`, `x`/`y` and `scaleX`/`scaleY` as complementary pose tools. Start from neutral transforms; choose changes from the intended motion and its projection. Foreshortening is a normal reason to use scale and translation without asking for a separate squash-and-stretch effect. Do not impose rotation-only motion, fixed 2D bone lengths or scale 1 on every view.

| Direction | Motion guidance |
| --- | --- |
| `right`, `left` | For motion mainly in the image plane, rotate hip/knee/ankle and shoulder/elbow/wrist around mapped pivots. Planar IK with constant segment lengths is a useful starting point. Add translation or scale if the pose actually moves into depth or needs a projected offset. |
| `front`, `back` | Forward/back limb travel is mainly into depth. Use projected knee/ankle/hand translations and controlled segment shortening/return via scale, with only the in-plane rotations the silhouette needs. A lifted foot must clear the ground; do not depict forward stepping as a broad sideways leg swing. |
| `front-right`, `front-left` | Combine visible sideways arcs with depth foreshortening and projected offsets. Determine which limb is near from this view's anatomy and artwork. |
| `back-right`, `back-left` | Combine rotations, foreshortening and offsets as in a rear diagonal projection; recalculate visible surfaces, contact landmarks and near/far order. Do not paste or mirror front-diagonal transforms. |

- **Front/back foot-lift workflow:** establish the ground and neutral projected hip→knee→ankle→toe chain. During recovery, move the knee and ankle to their lifted projected positions, shorten only the segments turned into depth, and preserve the appropriate boot silhouette. Use a smooth phase curve that rises and returns; alternate the other leg by half a cycle. Restore contact geometry for stance, accounting for root movement. The scale axis and amount come from the segment's local axes and intended pose, not a blanket `scaleY` applied to the entire character.
- Anatomical limb length stays stable in the intended spatial pose, but its 2D projected length may vary. Prefer a projected anatomical pose or a reviewed set of view-specific targets; a scalar length or 2D angle alone cannot reconstruct depth or prove correct flexion. Avoid flattened limbs, unexplained changes of character size, negative scales, joint flips and detached attachments. Rotation/translation/scale cannot synthesize a missing palm, sole or side texture; request/generate appropriate artwork when a visible surface changes.
- Build each pose parent-first. Convert a canvas-space child target with `localXY = inverseRotateZ(target - posedParent, worldAngleParent) / worldScaleParent - (bindChild - bindParent)`. Solve after inherited Z rotation and scale; avoid applying the same lift twice. Keep scale positive and interpolate projected shortening smoothly.
- The current renderer warps an intact limb along its posed chain and derives axial stretch/compression from segment lengths. It does not apply every Node scale as an independent uniform texture resize. Review the saved rendered pose, not just scale values. Keep rigid boots, gloves, weapons and armor attached and preserve their shape through appropriate distal transforms; account for inherited scale before adding compensation. If the mapped Path cannot preserve a rigid section while foreshortening another, identify the mapping/artwork limitation rather than claim the transform alone fixes it.
- Decide the intended anatomical bend direction from the character and view, then use rotations for visible pivot arcs and translations/scales for the projected depth component. Interpolate along the shortest sensible rotation arc and avoid sudden flips between frames.
- For a human-like leg, use the intended anatomical straight pose as 0°; flex only toward the natural back-of-knee bend. Use 0–90° for ordinary walk/run poses and treat 130° as a conservative maximum for a deep bend; never extend past straight or reverse the knee. For a human-like elbow, flex toward the palm/inside-arm bend, with 0° straight and a conservative 145° maximum; do not hyperextend it. These are animation guardrails, not universal species limits or values to put directly into API `rotation`. Convert visible in-plane bends to the correct signed rotation for each direction. For front/back depth motion, assess the intended spatial pose and projected silhouette; do not treat its projected 2D angle as the anatomical joint angle.
- For non-human characters, infer each joint's permitted flexion from its actual anatomy and rig orientation. Do not apply human knee/elbow limits to wings, tails, trunks, digitigrade legs, or other creature joints. When anatomy or intended bend direction is ambiguous, ask rather than create a pose that appears broken.
- Author per-direction poses because projected joint axes and apparent bend directions vary by view. During a walk, coordinate alternating legs and opposite arm swing, preserve foot contact during stance, add modest knee flexion during swing, and use small compensating pelvis/torso/head rotations. For flight or flexible appendages, phase wing/tail/trunk rotations as a connected chain.
- On every authored frame, include transforms for every active character rig Node and inspect every mapped body piece. No visible body piece should accidentally freeze: it must move through its parent chain or receive purposeful local rotation, translation or scale appropriate to the pose. Rigid equipment may keep its local pose and inherit its host motion; preserve its shape under projection changes and do not add gear-only motion unless requested. Keep motion subtle where a body part is meant to stabilize.
- If the requested clip is frame-by-frame, provide a pose at each frame in the cycle (within the API's 0–24 range), not just start/end keys. Make consecutive frames flow continuously and verify the loop joins cleanly. Do not claim physics simulation; the motion is authored in Animation keyframes.
