/godot-dev:godot-2d-rigfrom godot-dev
Converts rig2d.json character data into Godot Skeleton2D, Bone2D, and weighted Polygon2D parts for cut-out animation and 2D IK. Includes a Python conversion script and reference docs for rigging, animation, and IK.
Ships in godot-dev. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
A rig2d/1 file becomes a Skeleton2D with Bone2D nodes and weighted Polygon2D parts, one
per layer, drawn in the layer order and standing on the node's position.
| The situation | Read |
|---|---|
A layered character (rig2d.json and layer PNGs) from comfyui-asset-generation; "rig this in Godot" | The conversion below, then reference/rig2d-mapping.md §1-3 |
| Which way y goes, where the origin is, why a bone points the wrong way | reference/rig2d-mapping.md §2 |
| Skinned mesh parts or stiff cut-out sprites | reference/rig2d-mapping.md §3 |
| An arm drawn behind the torso; parts interleaving with the world | reference/rig2d-mapping.md §4 |
| Blinking, mouth shapes: switching swap states | reference/rig2d-mapping.md §5 |
| The head turn, gaze, an idle sway from the rig's own data | reference/rig2d-mapping.md §6 |
Animating bones with an AnimationPlayer | reference/rig2d-mapping.md §7 |
| A hand reaching a target, feet planted: 2D IK | reference/ik-2d.md |
| Building the character at runtime from the JSON; checking a rig in the engine | resources/rig2d_builder.gd · reference/rig2d-mapping.md §8 |
| Frame-by-frame sprites instead of bones | godot-2d-sprites |
| Blend trees and state machines over the bone animations | godot-animation |
python3 scripts/rig2d_to_scene.py game/art/courier/rig/rig2d.json \
--out game/art/courier/courier_rig.tscn --name Courier
python3 scripts/rig2d_to_scene.py game/art/courier/rig/rig2d.json --mode cutout \
--out game/art/courier/courier_cutout.tscn
python3 scripts/rig2d_to_scene.py game/art/courier/rig/rig2d.json --check-only
The scene it writes (no Godot needed to convert; import the project once afterwards so the layer PNGs load):
Courier (Node2D) metadata: rig2d_origin, rig2d_view, rig2d_swaps, rig2d_face, rig2d_sway
├── Skeleton2D
│ └── hips (Bone2D) └── chest ── head, upperarm_R ── forearm_R ── hand_R, ...
└── Parts (Node2D) one Polygon2D per layer, bottom layer first
├── leg_L ... torso ... head ... eyes_closed (hidden) ... arm_R
Exit codes: 0 written (or --check-only passed) · 2 the rig failed a check, each problem on a
FAIL line, nothing written · 1 a usage error, a stamp other than rig2d/1, a rig2d/1 file
missing a required key · 3 a missing or unreadable file (a layer PNG).
--origin ground (default) puts the root bone's x and the
lowest vertex on the node's position, so the courier stands where it is placed.Bone2D sits at its head relative to its parent's
head, with rest equal to that transform; length and bone_angle come from head to tail
with auto-calculation off. In the scene text bone_angle is degrees; through the API it is
radians.bw holds two (bone, weight) pairs per vertex; each
Polygon2D gets one weight array per bone, as long as its vertex list, bones named by path
relative to the Skeleton2D. Weights must sum to 1 per vertex (checked).layers runs top to bottom and Godot draws later
siblings on top, so parts are written bottom first. Cut-out sprites, spread over bones, use
z_index instead.set_swap() switches by label.bw has two pairs per vertex.extends Node2D
const Rig2D = preload("res://tools/rig2d_builder.gd")
@onready var courier: Node2D = $Courier
func _ready() -> void:
var problems := Rig2D.check(courier) # rest set, bone paths, weights, rest pose
assert(problems.is_empty(), "\n".join(problems))
var lib := AnimationLibrary.new()
lib.add_animation(&"idle", Rig2D.sway_idle(courier))
var player := AnimationPlayer.new() # a child of the root: tracks are relative to it
courier.add_child(player)
player.add_animation_library(&"", lib)
player.play(&"idle")
Rig2D.add_two_bone_ik($Courier/Skeleton2D, NodePath("hips/chest/upperarm_R"),
NodePath("hips/chest/upperarm_R/forearm_R"), NodePath("../HandTarget"))
func blink() -> void:
Rig2D.set_swap(courier, "eyes", "closed")
await get_tree().create_timer(0.12).timeout
Rig2D.set_swap(courier, "eyes", "open")
Rig2D.build("res://art/courier/rig/rig2d.json") builds the same tree in the engine (mesh
parts), for characters loaded at runtime; the selftest checks that it matches the converter's
scene bone for bone and weight for weight.
rig2d_to_scene.py --check-only on the JSON, before any Godot run.-s run, add it to the tree, wait a frame, and read: the
Skeleton2D.get_bone_count, each bone's global position against its head minus the origin,
Bone2D.get_bone_angle against the head-to-tail angle, the order of the Parts node's children
against layers reversed, and the builder's check() empty.AnimationPlayer.advance moves a swayed bone to the angle the formula gives.scripts/rig2d_to_scene.py --selftest (needs GODOT_BIN) does all of the above on a small
courier: both modes, the in-engine builder, swaps, IK, the sway idle, and each check failing with
its exit code. Trust a Godot run by its sentinel line and the absence of ERROR: lines, never by
its exit code (godot-verify).
| Need | Skill |
|---|---|
| The layered character itself: layers, bones, weights, the split's gates | comfyui-asset-generation |
| Which track a character takes (frames or a rig) | game-character-pipeline |
| Frame animation | godot-2d-sprites |
| Animation trees, blending, state machines | godot-animation |
| Draw order with the rest of the world, 2D lights | godot-2d-rendering |
| Running Godot headless and trusting the result | godot-verify |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
godot, 2d-rigging, cut-out-animation, skeleton2d, inverse-kinematics
npx claudepluginhub tipoli5890/game-studio --plugin godot-dev28 skills in this plugin
/godot-2d-controllerMove a 2D character in Godot: CharacterBody2D jump, coyote time, jump buffer, slopes, one-way and moving platforms, top-down movement./godot-2d-renderingGodot 2D look: draw order, z_index and y-sort, CanvasLayer, 2D lights and shadows, canvas shaders, Parallax2D, pixel-perfect scaling./godot-2d-spritesSprite frames into Godot: frames.json to SpriteFrames, AnimatedSprite2D, sheet slicing, pivots, filtering and import for pixel art.