Roblox box-rig animals
You write one small data file for each animal: palette, bones, boxes and clips. scripts/boxrig.py turns that file into the mesh, studs, rig, animations, mutations, renders and exports.
Examples, with previews in examples/previews/:
examples/penguin.py: a biped.examples/dragon.py: a full-size dragon: smooth voxel body/S-neck/tail + box-built head, horns, plates and bat wings, with a jaw and a fire-breath idle.examples/lion.py: an anatomy-correct lion with the chunky look: smooth voxel body, big studs, pixel-art face drawn on the voxel grid.examples/lion_chibi.pyis the old chibi lion, kept as a box-API example.
Requirements
- Blender 4.2 or later, run headless. On Windows look in
C:\Program Files\Blender Foundation\Blender */blender.exe; on Mac,/Applications/Blender.app/Contents/MacOS/Blender. Tested on 5.1. - Python 3 with Pillow and numpy:
py -m pip install --user pillow numpy. Don't run the scripts withpy -I. - Placeholders below:
<B>= the Blender executable,<S>= this skill's folder.
Workflow
- Spec, anatomy first (user rule). Every animal gets the structure of the real animal: its real body plan, proportions and silhouette, built from blocks. Never a cube character with features stuck on.
- Read
reference/anatomy.md. Look up the real animal, or use the user's reference. - Write its proportions in shoulder heights as comments in the data file: body length, head, neck, legs, tail.
- Block out the side silhouette with big shapes, and match it before adding detail.
- Chibi or "cute pet" proportions (big head, stub legs) only when the user asks for them.
- Note 2–4 signature traits and the clips (default Walk, Run, Idle). A user's reference image or model is the spec.
- Decide the scale: a Roblox character is about 5 studs tall; pets are 4–8 studs; real-size creatures are life-sized (a dragon is about 40 studs long). Don't shrink big animals.
- Read
- Copy the closest example into the user's folder, or run
py <S>/scripts/new_animal.py <Name> quad|biped <folder>. Never edit inside the skill. - Edit the data. Read
reference/design_guide.mdfirst. - Build and render:
<B> -b --factory-startup --python <S>/scripts/boxrig.py -- <animal.py> all py <S>/scripts/make_sheet.py <out_dir> _v1<out_dir>isout_<Name>next to the file.- The modes are
views(fast, for shaping),gif,export,mutations(views, export and mutations) andall.
- Review
<Name>_sheet_vN.png,review_<Clip>_vN.pngand<Name>_mutations_vN.png. Fix the data and rebuild with a new tag, because the Read tool caches images by path. Usually 3–5 rounds. - Verify:
<B> -b --factory-startup --python <S>/scripts/verify_fbx.py -- <out_dir>must printVERIFY_OK. - Deliver the sheet, the mutation sheet and the GIFs.
- Studio, if the Roblox Studio MCP is connected. Follow
reference/roblox_studio.md: import, fix-up,BoxRigAnimplus<Name>Clipsfor poses and KeyframeSequences,MutationFX, then a measured playtest.
Data file cheat sheet
- Units and axes: studs, Z up, front = -Y, the animal's left = +X.
- Boxes:
box(x0,x1, y0,y1, z0,z1, colour, bone).sym(...)mirrors the box to the right side, with%becomingLorRin the bone name;boxwith%in the bone does the same. A later box wins where boxes overlap. - Voxel sculpting (the default for creature bodies): set
VOXELsmall enough for smooth curves (about 1/90 of body length: 0.5 on a big dragon, 0.2 on a lion) andSTUD_SIZEbigger (2–4 cells, e.g. 1.0 / 0.8) so studs stay chunky and readable. Then:vell(cx,cy,cz, rx,ry,rz, col, bone): ellipsoid.vcap(p0, p1, r0, r1, col, bone): tapered capsule, for necks, legs, tails, horns and snouts.vbox(...): box.vsheet(origin, u, v, pts, thick, col, bone): flat polygon, for wings, fins and frills; bone('a', split, low, high)splits it between two bones.- Options:
paint=Truerecolours existing voxels only (belly stripe, eyes, markings);paint='belly'recolours only cells of that colour (bands across a stripe);'%'in the bone mirrors to L and R;mirror=Truemirrors on the same bone (horns, teeth). - Everything is voxelized on one grid and greedily meshed. Keep radii at or above one voxel, or thin parts break up. Read "The default style = smooth SHAPE + chunky LOOK" in
reference/design_guide.md.
- Organic shapes, box-based (older chunky style):
ell(cx,cy,cz, rx,ry,rz, colour, bone)is a rounded stepped blob made of 3 boxes. Use it for bodies, chests, hips, neck segments, thighs and tail segments.poly([(x,y),...], z0, z1, colour, bone, step=1.0)fills a top-view outline. Use it for wing membranes, fins, frills and tail spades.bonecan be a function of x, to split a membrane across Wing and WingTip.beam(p0, p1, width, z0, z1, colour, bone)is a straight bar, for arm bones, wing fingers and horns.
- Winged animals: model the wings spread flat, then fold them in the clips with
wing_rest=(raise, tip_droop, sweep); the dragon uses(58, 24, 22). SetVIEW_POSE = ('Idle', 0)so the sheet shows the animal standing with its wings folded. - Bones:
BONES[name] = (parent, head, tail). Exactly one root at(0,0,0), which has no boxes. The head point is the pivot.- Quad clips need
Body,Head,FrontUpper/Lower_L/RandBackUpper/Lower_L/R. Optional: a tail chain, aneckchain,wings=('Wing','WingTip')and ajaw. - Biped clips need
Body,HeadandLeg_L/R. Optional:Foot_L/R,Wing_L/Rand a tail.
- Quad clips need
- Clips:
CLIPS = {'Walk': (fn, frames), ...}at 30 fps, seamless, in place.- Ready-made factories (keyword arguments only):
quad_walk,quad_run,quad_idle(jaw=, yawn=),quad_flybiped_walk,biped_run,biped_idle,biped_fly
- Animals that fly (dragons, birds, griffins, bats, anything with working wings), a user rule:
- Walk is a ground walk: the legs move and the wings stay still. Use
quad_walk(..., wings=..., wing_flap=0), orbiped_walk(..., wing_flap=0). - Run is flying: the wings beat and the legs don't run; they stay tucked and still. Use
quad_fly(...)orbiped_fly(...), neverquad_runorbiped_run. - Never flap the wings while the legs run.
- Walk is a ground walk: the legs move and the wings stay still. Use
- Fire breath (dragons and other breathers):
quad_idle(jaw='Jaw', yawn=26, fire=(0.55, 0.75))plusMOUTH = (x, y, z)andMOUTH_BONE = 'Head'in the data file.- The clip rears back and inhales, then thrusts forward with the jaw open from t0 to t1.
- The GIFs show a stand-in flame. In Studio,
assets/FireBreath.luadrives real flames from the clip's FireStart and FireStop markers, coloured per mutation. - Fire never shows in the Animation Editor, which plays bones only. To show it in Edit mode, use
assets/BoxRigPreview.lua. - A forward-pointing jaw opens down with
rx +.rx -swings it up into the skull, where it looks like it vanished.
- Typical lengths: walk 32–40 frames, run 18–24, idle 90–150.
- Big animals move slower and heavier: more frames, larger
bobandbouncein studs, and a lowerpitch. - A custom clip is
fn(t) -> {bone: ((rx,ry,rz) degrees about world axes at the joint, (tx,ty,tz) studs)}. Signs:rx +swings a foot back, nods a head down and lifts a tail.
- Ready-made factories (keyword arguments only):
- Mutations (Gold, Diamond and Shadow by default) come from
MUTATIONSinboxrig.py.- Each one maps the palette's brightness onto a smooth colour ramp.
ROLESnames the eye parts (iris,eye,shine,blush) so they get the mutation's complementary eye colours.keepleaves keys such as teeth unchanged.- Override them with
MUTATIONS = {...}and pick a subset withMUTATIONS_USE.
Roblox-friendly by construction (don't break these)
- One draw call: one mesh, one material and one shared 512 px tiling stud texture. Colours are vertex colours, which Roblox multiplies by the TextureID.
- Rigid skinning (1.0 weights) and culling of faces hidden by another box on the same bone.
- Size: about 800 triangles for a pet and about 1,600 for a dragon. Keep mobs under about 3k; the hard limit is 20k.
- Mutations are separate meshes on the same rig: every animation works on every variant. The effects come from one emitter and at most one light per model.
- Export: FBX with no leaf bones, FBX unit scale, -Z forward and Y up, the root at the origin, one clip per FBX.
More detail: reference/design_guide.md, reference/roblox_rules.md, reference/roblox_studio.md and reference/pitfalls.md.