# Skeleton2D bone hierarchies, rest poses and two-bone IK. ```{raw} html ▶ Run in browser ``` **Tags:** `2d` `skeleton` `bones` `animation` `ik` `procedural` An articulated figure built entirely from Bone2D nodes, with no art assets: each bone carries a tapered Polygon2D limb as a child, so the bone hierarchy alone places the geometry. The spine and neck sway from a pose offset, the right arm waves from an AnimationClip, and the left arm is driven by an analytical two-bone IK solver that keeps the hand on a moving target while the whole torso rotates underneath it. ## What it demonstrates - Building a rig from a declarative table: Bone2D parented to Bone2D, each one offset along its parent by a fraction of the parent's `bone_length`. - `set_as_rest()` to capture the authored pose, and `reset_to_rest()` to snap the whole skeleton back to it. - The two rotation channels a bone has: `rotation` is the authored local angle, `bone_angle` is a pose offset layered on top. The sway and the wave both drive `bone_angle`, so neither one destroys the rest pose. - Attaching drawables to bones. The limbs and the skull are ordinary Polygon2D children; nothing recomputes their positions, the transform hierarchy does it. - `SkeletonModification2DTwoBoneIK` registered with `add_modification()`, which `Skeleton2D.on_update` then runs every frame without any calling code. - `bone_tip` for the end point of a bone, used both by the IK check and by the gizmo overlay. Controls: SPACE - Wave the right arm G - Toggle the bone gizmos F - Flip the IK elbow R - Reset the skeleton to its rest pose ESC - Quit Run: uv run python examples/features/2d/skeleton2d.py Headless self-check: uv run python examples/features/2d/skeleton2d.py --test ## Source ```{literalinclude} ../../examples/features/2d/skeleton2d.py :language: python :linenos: ```