A mech game prototype, pushed by Fable 5.2
agent
+2:21[redacted: image of existing project work]
Tools work (block build 3 s, quick clip 57 s). I've picked the visual: one moving sketch sheet of six block mechs seen from behind in flight. Reading the rig and kit primitives now.
Bashgrep -n "^def \|^class " kit/lib.py | head -80 && grep -n "def joints" -A 60 kit/mech.py | head -110 && grep -n "POSES" -B2 -A 40 src/render/mech.ts | sed -n 1,90p
command
grep -n "^def \|^class " kit/lib.py | head -80 && grep -n "def joints" -A 60 kit/mech.py | head -110 && grep -n "POSES" -B2 -A 40 src/render/mech.ts | sed -n 1,90p
result, 170 lines
38:def reset(): 46:def material(role): 55:def link(o): 60:def empty(name, at=(0, 0, 0), parent=None, **extras): 73:def attach(o, parent): 84:def octo(w, d, c=0.2, cf=None, cb=None, x=0.0, y=0.0): 95:def circle(r, n=12, x=0.0, y=0.0, phase=0.5): 100:def ccw(poly): 107:def loft(rings, axis="z", caps=True): 130:def prism(poly, lo, hi, plane="xz"): 138:def _outward(bm): 142:def merge(*bms): 153:def transform(bm, m): 158:def mirror_x(bm): 170:def rot(axis, deg, about=(0, 0, 0)): 176:def solid(name, bm, role, parent=None, bevel=0.0, segs=1, angle=40, smooth=False, outline=True, panels=None): 209:def panel_lines(o, min_area=1.1, width=0.05, depth=0.016): 221:def bake(o): 232:def boolean(target, cutter_bm, op="DIFFERENCE", role=None): 255:def two_view(front, side, top=None, span=60.0): 272:def clip(bm, x=(-60, 60), y=(-60, 60), z=(-60, 60)): 290:def copy(bm): 299:def _keep_side(bm, co, no, below): 310:def halves(bm, co, no, gap=.04): 319:def panels(bm, cuts, gap=.04): 334:def fold(objs, t, half, y0, y1): 354:def piston(p0, p1, r=.12, n=8): 367:def subd(bm, levels=2, sharp=45, crease=1.0): 396:def cylinder(r, z0, z1, n=10, r1=None, axis="z", at=(0, 0)): 403:def nozzle(r_out, length, n=12, flare=1.25): 423:def slats(x0, x1, z0, z1, y, n, depth=0.12, gap=0.35): 434:def export(path, extras=True): 69:def joints(): 70- J = {"frame": empty("frame", (0, 0, 0), frame="striker", height=17.6)} 71- J["pelvis"] = empty("pelvis", (0, 0, 10.6), J["frame"]) 72- J["waist"] = empty("waist", (0, 0, 11.1), J["pelvis"]) 73- J["torso"] = empty("torso", (0, 0, 11.9), J["waist"]) 74- J["neck"] = empty("neck", (0, 0, 15.3), J["torso"]) 75- J["head"] = empty("head", (0, 0, 15.85), J["neck"]) 76- J["backpack"] = empty("backpack", (0, 1.5, 13.8), J["torso"]) 77- J["cockpit"] = empty("cockpit", (0, -0.75, 13.7), J["torso"]) 78- for s, sx in (("L", 1), ("R", -1)): 79- J["shoulder", s] = empty(f"shoulder.{s}", (2.0 * sx, 0, 14.6), J["torso"]) 80- J["upperarm", s] = empty(f"upperarm.{s}", (2.45 * sx, 0, 14.4), J["shoulder", s]) 81- J["forearm", s] = empty(f"forearm.{s}", (2.5 * sx, 0, 11.95), J["upperarm", s]) 82- J["hand", s] = empty(f"hand.{s}", (2.5 * sx, 0, 9.6), J["forearm", s]) 83- J["grip", s] = empty(f"grip.{s}", (2.36 * sx, -0.02, 9.12), J["hand", s]) 84- J["thigh", s] = empty(f"thigh.{s}", (1.15 * sx, 0, 10.55), J["pelvis"]) 85- J["shin", s] = empty(f"shin.{s}", (1.2 * sx, 0, 6.1), J["thigh", s]) 86- J["foot", s] = empty(f"foot.{s}", (1.2 * sx, 0.1, 1.55), J["shin", s]) 87- J["binder", s] = empty(f"binder.{s}", (0.9 * sx, 2.25, 14.7), J["backpack"]) 88- return J 89- 90- 91-def lr(J, part): 92- return J[part, "L"], J[part, "R"] 93- 94- 95-def build_pelvis(J): 96- P = J["pelvis"] 97- solid("pelvis_core", loft([(9.95, octo(.9, 1.3, .25)), (10.4, octo(2.2, 1.7, .4)), (11.0, octo(2.3, 1.75, .45))]), 98- "frame", P, BEVEL) 99- # the waist belt flares from the abdomen out to hip width; everything below hangs from it 100- solid("belt", loft([(10.55, octo(3.2, 2.05, .5)), (10.98, octo(2.1, 1.7, .42))]), "main", P, BEVEL) 101- solid("belt_buckle", two_view([(-.3, 10.58), (.3, 10.58), (.18, 10.96), (-.18, 10.96)], 102- [(-1.14, 10.58), (-.96, 10.58), (-.86, 10.96), (-1.02, 10.96)]), "trim", P, .02) 103- pair("hip_block", loft([(10.2, octo(.42, .95, .1, x=1.74)), (10.72, octo(.42, .95, .1, x=1.74))]), "frame", P, P, bevel=.02) 104- solid("codpiece", two_view([(-.2, 9.62), (.2, 9.62), (.32, 10.2), (.3, 10.58), (-.3, 10.58), (-.32, 10.2)], 105- [(-1.14, 9.68), (-.75, 9.68), (-.8, 10.58), (-1.08, 10.58), (-1.22, 10.2)]), "trim", P, BEVEL) 106- # front skirt: two blades sweeping out from the centre like an arrowhead 107- pair("skirt_front", two_view([(.45, 10.62), (1.45, 10.62), (2.05, 10.3), (1.65, 9.6), (.65, 9.9)], 108- [(-1.34, 9.55), (-1.02, 9.55), (-.94, 10.66), (-1.24, 10.66)]), "main", P, P, bevel=BEVEL) 109- pair("skirt_front_edge", two_view([(.68, 9.85), (1.64, 9.55), (1.74, 9.71), (.72, 9.99)], 110- [(-1.4, 9.47), (-1.06, 9.47), (-1.02, 10.05), (-1.36, 10.05)]), "accent", P, P, bevel=0.015) 111- # side skirts flare out toward the bottom, tips swept back 112- # side skirts hinge from the hip blocks: a cap plate over a ridged main plate 113- pair("skirt_side", two_view([(2.0, 9.5), (2.34, 9.5), (2.12, 10.5), (1.86, 10.52)], 114- [(-.6, 9.5), (1.05, 9.5), (.95, 10.54), (-.9, 10.54)], 115- top=[(1.8, -1.0), (2.17, -1.0), (2.42, .05), (2.17, 1.15), (1.8, 1.15)]), "main", P, P, bevel=BEVEL) 116- pair("skirt_side_cap", two_view([(1.86, 10.28), (2.3, 10.22), (2.22, 10.74), (1.86, 10.76)], 117- [(-.72, 10.22), (.92, 10.22), (.86, 10.76), (-.78, 10.76)]), "accent", P, P, bevel=0.025) 118- pair("skirt_side_plate", two_view([(2.26, 9.66), (2.4, 9.69), (2.26, 10.16), (2.12, 10.14)], 119- [(-.4, 9.66), (.85, 9.66), (.78, 10.16), (-.55, 10.16)]), "frame", P, P, bevel=0.015) 120- # rear skirt as two overlapping scales with a gap over the hip mechanism 121- # rear skirt: descending chevrons, a gap at the centre 122- pair("skirt_rear", two_view([(.14, 10.6), (1.26, 10.66), (1.61, 10.35), (1.46, 9.92), (.64, 9.82), (.18, 10.05)], 123- [(.92, 9.75), (1.26, 9.75), (1.32, 10.7), (.94, 10.7)]), "main", P, P, bevel=BEVEL) 124- pair("skirt_rear_low", two_view([(.14, 10.1), (.62, 9.93), (1.3, 10.02), (1.3, 9.63), (.6, 9.4), (.14, 9.6)], 125- [(1.02, 9.36), (1.36, 9.36), (1.36, 10.14), (1.02, 10.14)]), "main", P, P, bevel=0.03) 126- 127- 128-def build_waist(J): 129- W = J["waist"] 16-export type Joint = (typeof JOINTS)[number]; 17- 18:export const POSES = { 19- stand: { 20- 'upperarm.L': [0, 0, 6], 'upperarm.R': [0, 0, -6], 'forearm.L': [-12, 0, 0], 'forearm.R': [-12, 0, 0], 21- }, 22- /** Standing on the catapult: knees bent, leaning into the launch. */ 23- launch: { 24- pelvis: [8, 0, 0], torso: [10, 0, 0], head: [-14, 0, 0], 25- 'thigh.L': [-38, 0, 2], 'thigh.R': [-38, 0, -2], 'shin.L': [58, 0, 0], 'shin.R': [58, 0, 0], 26- 'foot.L': [-20, 0, 0], 'foot.R': [-20, 0, 0], 27- 'upperarm.L': [-18, 0, 14], 'forearm.L': [-40, 0, 0], 'upperarm.R': [-30, 0, -8], 'forearm.R': [-50, 0, 0], 28- 'binder.L': [18, 0, 0], 'binder.R': [18, 0, 0], 29- }, 30- /** The launch crouch for a heavy: 24 m in a 26 m tube, so knees deep, head down and binders folded, 31- * which brings it under the tube's signal box. */ 32- launch_heavy: { 33- pelvis: [12, 0, 0], torso: [12, 0, 0], head: [-20, 0, 0], 34- 'thigh.L': [-58, 0, 3], 'thigh.R': [-58, 0, -3], 'shin.L': [106, 0, 0], 'shin.R': [106, 0, 0], 35- 'foot.L': [-48, 0, 0], 'foot.R': [-48, 0, 0], 36- 'upperarm.L': [-18, 0, 14], 'forearm.L': [-40, 0, 0], 'upperarm.R': [-30, 0, -8], 'forearm.R': [-50, 0, 0], 37- 'binder.L': [40, 0, 0], 'binder.R': [40, 0, 0], 38- }, 39- /** Free flight, rifle up. */ 40- flight: { 41- pelvis: [6, 0, 0], torso: [-4, 0, 0], head: [-2, 0, 0], 42- 'thigh.L': [-22, 0, 4], 'thigh.R': [6, 0, -3], 'shin.L': [42, 0, 0], 'shin.R': [30, 0, 0], 43- 'foot.L': [8, 0, 0], 'foot.R': [18, 0, 0], 44- 'upperarm.L': [-22, 0, 16], 'forearm.L': [-46, 0, 0], 45- 'upperarm.R': [-62, -8, -6], 'forearm.R': [-26, 0, 0], 'hand.R': [0, 0, 0], 46- 'binder.L': [-6, 0, 0], 'binder.R': [-6, 0, 0], 47- }, 48-} satisfies Record<string, Pose>; 49:export type PoseName = keyof typeof POSES; 50- 51-/** The catapult pose for a size class: the striker's, with a deeper crouch for heavies. */ 52:export const launchPose = (cls: string): Pose => (cls === 'heavy' ? POSES.launch_heavy : POSES.launch); 53- 54-export interface Nozzle { 55- node: THREE.Object3D; 56- dir: THREE.Vector3; // exhaust direction in the node's parent space 57- radius: number; 58- kind: NozzleKind; 59- plume: THREE.Mesh; 60-} 61- 62-const tmpQ = new THREE.Quaternion(); 63-const _sum = new THREE.Vector3(); 64-const _at = new THREE.Vector3(); 65-const _white = new THREE.Color(1, 1, 1); 66-const tmpE = new THREE.Euler(); 67-const D = THREE.MathUtils.DEG2RAD; 68- 69-/** A frame model's joints, posed by rotation, with weapons held at grip.R and thruster plumes. */ 70-export class MechRig { 71- readonly joints = new Map<Joint, THREE.Object3D>(); 72- readonly nozzles: Nozzle[] = []; 73- readonly cockpit: THREE.Object3D; 74- readonly grip: THREE.Object3D; 75- held: THREE.Object3D | null = null; 76- /** Plume state, stepped by thrust(). */ 77- readonly exhaust = new Exhaust(); 78- /** One plume material per nozzle kind: a kind fires together. */ 79- private plumeMats: Record<NozzleKind, THREE.ShaderMaterial>; 80- private exhaustColor: THREE.Color; 81- private targets = new Map<Joint, THREE.Quaternion>(); 82- 83- constructor(readonly root: THREE.Object3D) { 84- const map = nodes(root); 85- for (const j of JOINTS) { 86- const n = find(map, j); 87- if (n) this.joints.set(j, n); 88- } 89- this.cockpit = find(map, 'cockpit') ?? root; 90- this.grip = find(map, 'grip.R') ?? root; 91- const paint = PALETTES[(root.userData.palette as PaletteName | undefined) ?? 'merc'].glow_exhaust; 92- this.exhaustColor = new THREE.Color(paint.color);Bashsed -n 84,175p kit/lib.py && sed -n 250,272p kit/lib.py && grep -n "def nozzle_pair" -A 30 kit/mech.py && grep -n "def pair" -A 12 kit/mech.py && grep -n "merc" -A 14 src/render/palette.ts | head -50
command
sed -n 84,175p kit/lib.py && sed -n 250,272p kit/lib.py && grep -n "def nozzle_pair" -A 30 kit/mech.py && grep -n "def pair" -A 12 kit/mech.py && grep -n "merc" -A 14 src/render/palette.ts | head -50
result, 204 lines
def octo(w, d, c=0.2, cf=None, cb=None, x=0.0, y=0.0): """A chamfered rectangle, w along X and d along Y, CCW seen from above. The front (-Y) and back chamfers can differ: cf, cb. Returns 8 points.""" cf = c if cf is None else cf cb = c if cb is None else cb hw, hd = w / 2, d / 2 cf, cb = min(cf, hw * 0.95, hd * 0.95), min(cb, hw * 0.95, hd * 0.95) return [(x - hw + cf, y - hd), (x + hw - cf, y - hd), (x + hw, y - hd + cf), (x + hw, y + hd - cb), (x + hw - cb, y + hd), (x - hw + cb, y + hd), (x - hw, y + hd - cb), (x - hw, y - hd + cf)] def circle(r, n=12, x=0.0, y=0.0, phase=0.5): return [(x + r * math.cos(2 * math.pi * (i + phase) / n), y + r * math.sin(2 * math.pi * (i + phase) / n)) for i in range(n)] def ccw(poly): a = sum(poly[i][0] * poly[(i + 1) % len(poly)][1] - poly[(i + 1) % len(poly)][0] * poly[i][1] for i in range(len(poly))) return poly if a > 0 else list(reversed(poly)) # ---- solids (bmesh) --------------------------------------------------------------------------------------- def loft(rings, axis="z", caps=True): """rings: [(height, [(u, v), ...]), ...], all with the same point count. With axis "z" the outline is (x, y) at height z; "y" means (x, z) outlines along y; "x" means (y, z) outlines along x.""" bm = bmesh.new() loops = [] for h, pts in rings: loop = [] for u, v in pts: p = {"z": (u, v, h), "y": (u, h, v), "x": (h, u, v)}[axis] loop.append(bm.verts.new(p)) loops.append(loop) n = len(loops[0]) for a, b in zip(loops, loops[1:]): for i in range(n): j = (i + 1) % n bm.faces.new((a[i], a[j], b[j], b[i])) if caps: bm.faces.new(list(reversed(loops[0]))) bm.faces.new(loops[-1]) _outward(bm) return bm def prism(poly, lo, hi, plane="xz"): """A 2D outline pushed through [lo, hi]. plane "xz": outline in (x, z), depth along y. "yz": (y, z) along x. "xy": (x, y) along z.""" poly = ccw(poly) axis = {"xz": "y", "yz": "x", "xy": "z"}[plane] return loft([(lo, poly), (hi, poly)], axis=axis) def _outward(bm): bmesh.ops.recalc_face_normals(bm, faces=bm.faces) def merge(*bms): out = bmesh.new() for b in bms: me = bpy.data.meshes.new("_tmp") b.to_mesh(me) out.from_mesh(me) bpy.data.meshes.remove(me) b.free() return out def transform(bm, m): bmesh.ops.transform(bm, matrix=m, verts=bm.verts) return bm def mirror_x(bm): """A mirrored copy (left from right) with the winding fixed.""" me = bpy.data.meshes.new("_m") bm.to_mesh(me) out = bmesh.new() out.from_mesh(me) bpy.data.meshes.remove(me) bmesh.ops.scale(out, vec=(-1, 1, 1), verts=out.verts) bmesh.ops.reverse_faces(out, faces=out.faces) return out def rot(axis, deg, about=(0, 0, 0)): c = Vector(about) return Matrix.Translation(c) @ Matrix.Rotation(math.radians(deg), 4, axis) @ Matrix.Translation(-c) # ---- objects ---------------------------------------------------------------------------------------------- bpy.data.objects.remove(cutter, do_unlink=True) bpy.data.meshes.remove(me) return target def two_view(front, side, top=None, span=60.0): """Intersect a front outline (x, z) with a side outline (y, z), and optionally a top outline (x, y). Returns a bmesh. The classic way to block out armour and heads.""" a = prism(front, -span, span, "xz") me = bpy.data.meshes.new("_tv") a.to_mesh(me) a.free() o = link(bpy.data.objects.new("_tv", me)) boolean(o, prism(side, -span, span, "yz"), "INTERSECT") if top is not None: boolean(o, prism(top, -span, span, "xy"), "INTERSECT") bm = bmesh.new() bm.from_mesh(o.data) bpy.data.objects.remove(o, do_unlink=True) return bm def clip(bm, x=(-60, 60), y=(-60, 60), z=(-60, 60)): 41:def nozzle_pair(name, at, direction, r, length, jl, jr, shell="frame", housing=True): 42- ex = Vector(at) 43- for side, j, sx in (("L", jl, 1), ("R", jr, -1)): 44- p = Vector((ex.x * sx, ex.y, ex.z)) 45- d = Vector((direction[0] * sx, direction[1], direction[2])) 46- bell, glow = nozzle(r, length) 47- solid(f"{name}.{side}", place(bell, p, d), shell, j, smooth=True) 48- solid(f"{name}.{side}.glow", place(glow, p, d), "glow_thruster", j, outline=False) 49- # an armoured housing around the throat, so the nozzle reads as mounted, not floating 50- if housing: 51- house = loft([(length * .5, octo(r * 2.5, r * 2.5, r * .6)), (-length * .3, octo(r * 2.3, r * 2.3, r * .55))]) 52- solid(f"{name}_housing.{side}", place(house, p, d), "main", j, bevel=.02, panels=False) 53- empty(f"nozzle.{name}.{side}", p + d.normalized() * length, j, dir=gltf_dir(d), radius=r) 54- 55- 56-def seam(bm, a, b, gap=.05): 57- """Split a solid along the line a->b of the front view (x, z): two plates with a real seam.""" 58- a, b = Vector((a[0], 0, a[1])), Vector((b[0], 0, b[1])) 59- d = (b - a).normalized() 60- n = Vector((-d.z, 0, d.x)) 61- return halves(bm, a, n, gap) 62- 63- 64-def pair_pieces(name, pieces, role, jl, jr, **kw): 65- for i, bm in enumerate(pieces): 66- pair(f"{name}{i}", bm, role, jl, jr, **kw) 67- 68- 69-def joints(): 70- J = {"frame": empty("frame", (0, 0, 0), frame="striker", height=17.6)} 71- J["pelvis"] = empty("pelvis", (0, 0, 10.6), J["frame"]) 35:def pair(name, bm_left, role, jl, jr, **kw): 36- """Make the left part and its mirror on the right.""" 37- bm_right = mirror_x(bm_left) 38- return solid(f"{name}.L", bm_left, role, jl, **kw), solid(f"{name}.R", bm_right, role, jr, **kw) 39- 40- 41-def nozzle_pair(name, at, direction, r, length, jl, jr, shell="frame", housing=True): 42- ex = Vector(at) 43- for side, j, sx in (("L", jl, 1), ("R", jr, -1)): 44- p = Vector((ex.x * sx, ex.y, ex.z)) 45- d = Vector((direction[0] * sx, direction[1], direction[2])) 46- bell, glow = nozzle(r, length) 47- solid(f"{name}.{side}", place(bell, p, d), shell, j, smooth=True) -- 64:def pair_pieces(name, pieces, role, jl, jr, **kw): 65- for i, bm in enumerate(pieces): 66- pair(f"{name}{i}", bm, role, jl, jr, **kw) 67- 68- 69-def joints(): 70- J = {"frame": empty("frame", (0, 0, 0), frame="striker", height=17.6)} 71- J["pelvis"] = empty("pelvis", (0, 0, 10.6), J["frame"]) 72- J["waist"] = empty("waist", (0, 0, 11.1), J["pelvis"]) 73- J["torso"] = empty("torso", (0, 0, 11.9), J["waist"]) 74- J["neck"] = empty("neck", (0, 0, 15.3), J["torso"]) 75- J["head"] = empty("head", (0, 0, 15.85), J["neck"]) 76- J["backpack"] = empty("backpack", (0, 1.5, 13.8), J["torso"]) 67: /** Donor paint on salvaged parts: in a clean palette, the merc's own colours and an olive. */ 68- donor_a: paint('#d9dce1'), 69- donor_b: paint('#27527a'), 70- donor_c: paint('#5c6143'), 71- primer: paint('#8a8d84', 0.7, 0), 72- rust: metal('#6a3a20', 0.85, 0.35), 73- handpaint: paint('#ece4cc', 0.7, 0), 74- warpaint: paint('#c9452f', 0.6, 0), 75- /** The aliens' one material: unpainted silver, no seams. */ 76- crystal: metal('#c6c9d0', 0.44, 0.95), 77- /** Alien crystal lit from inside by the core, the lining of an opened geode. */ 78- crystal_lit: { color: '#a796dc', rough: 0.4, metal: 0.9, emit: 0.42 }, 79- /** The alien core light. */ 80- glow_violet: { color: '#7b3dff', glow: 2.6 }, 81- /** Stencilled markings: dark ink on light plates, light ink on dark ones. */ -- 89: merc: base, 90- /** The Administration: gate white plates, petrol blue accent blocks (the chest, the boots, the cheeks), 91- * gate cyan lights and trim. A light livery, so the frame goes darker to keep the value step. */ 92- admin: { 93- ...base, 94- main: paint('#e4e8eb'), 95- accent: paint('#1b5c5a', 0.45), 96- trim: paint('#3fa7c9', 0.35), 97- frame: metal('#3a3e45', 0.5, 0.8), 98- joint: metal('#24262b', 0.55, 0.9), 99- glow_eye: { color: '#5fd0f0', glow: 4 }, 100- glow_core: { color: '#5fd0f0', glow: 2.4 }, 101- glow_hot: { color: '#e6fbff', glow: 2.6 }, 102- glow_thruster: { color: '#9ee6ff', glow: 3 }, 103- glow_exhaust: { color: '#3fc4ff', glow: 1 },Bashsed -n 176,208p kit/lib.py && sed -n 1,34p kit/mech.py && sed -n 40,66p src/render/palette.ts && cat src/view/cameras.ts | head -40
command
sed -n 176,208p kit/lib.py && sed -n 1,34p kit/mech.py && sed -n 40,66p src/render/palette.ts && cat src/view/cameras.ts | head -40
result, 134 lines
def solid(name, bm, role, parent=None, bevel=0.0, segs=1, angle=40, smooth=False, outline=True, panels=None): """Turn a bmesh into an object with a material role, an optional chamfer on edges sharper than `angle`, flat or smooth shading, parented to a joint without moving. Armour roles get panel seams on their large faces unless panels=False.""" me = bpy.data.meshes.new(name) bm.to_mesh(me) bm.free() me.materials.append(material(role)) o = link(bpy.data.objects.new(name, me)) if bevel > 0: mod = o.modifiers.new("bevel", "BEVEL") mod.width = bevel mod.segments = segs mod.limit_method = "ANGLE" mod.angle_limit = math.radians(angle) mod.use_clamp_overlap = True mod.miter_outer = "MITER_ARC" bake(o) if panels is None: panels = role in ("main", "accent", "hull") and not smooth if panels: panel_lines(o) me = o.data if smooth: me.shade_smooth() me.set_sharp_from_angle(angle=math.radians(35)) if not outline: o["outline"] = False if parent is not None: attach(o, parent) return o """Mech frames. A frame is a tree of joint empties with rigid armour parented to them, so the game poses it by rotating joints (no skinning). Left is +X (the model faces -Y). Joint tree (names are the contract with src/render/mech.ts): frame > pelvis > waist > torso > neck > head torso > shoulder.L > upperarm.L > forearm.L > hand.L > grip.L torso > backpack > binder.L torso > cockpit pelvis > thigh.L > shin.L > foot.L Thruster exits are empties named nozzle.* with a "dir" extra (exhaust direction, glTF axes). Proportions follow measured Gundam 00 line art (review/out/refs/proportions.md): head about a tenth of the height, hip joint at 60%, shoulder span about half the height on shells that stand off a compact chest, a waist a ninth of the height, every limb in layered shells over a dark inner frame. """ from mathutils import Matrix, Vector from lib import (circle, clip, copy, cylinder, empty, halves, loft, merge, mirror_x, nozzle, octo, piston, prism, rot, slats, solid, transform, two_view) BEVEL = 0.05 def gltf_dir(v): v = Vector(v).normalized() return [round(v.x, 4), round(v.z, 4), round(-v.y, 4)] def place(bm, at, direction): """Turn a part built along -Z to point along `direction`, then move it to `at`.""" q = Vector((0, 0, -1)).rotation_difference(Vector(direction).normalized()) return transform(bm, Matrix.Translation(Vector(at)) @ q.to_matrix().to_4x4()) trim: paint('#c9452f', 0.4), frame: metal('#5b6069', 0.48, 0.8), joint: metal('#33363c', 0.55, 0.9), visor: { color: '#06080b', rough: 0.22, metal: 0.2, coat: 1 }, metal: metal('#9aa0a8', 0.3, 1), sensor: { color: '#1d6b5c', rough: 0.2, metal: 0.3, coat: 1 }, glow_eye: { color: '#7ef7e6', glow: 4 }, glow_core: { color: '#7ef7e6', glow: 2.4 }, /** The lit throat inside a thruster bell, the exhaust's colour. */ glow_thruster: { color: '#9cc6ff', glow: 3 }, /** Thruster plumes (render/plume.ts): the mantle colour, the core runs it to white. Glow scales * the whole plume. A maker or faction tints its drives here. */ glow_exhaust: { color: '#4f8fff', glow: 1 }, glow_beam: { color: '#ff5ccf', glow: 5 }, hull: paint('#a9adb4', 0.55, 0.15), hull_dark: metal('#4a4f57', 0.6, 0.6), interior: metal('#5e6168', 0.7, 0.3), deck: metal('#3f434a', 0.7, 0.6), hazard: paint('#e3b62b', 0.6, 0), light: { color: '#fff3df', glow: 1.7 }, screen: { color: '#4fd8cc', glow: 1.6 }, glass: { color: '#8f9fc4', rough: 0.22, metal: 0.1, coat: 1 }, lamp_red: { color: '#ff3a2e', glow: 4 }, lamp_green: { color: '#48ff6c', glow: 4 }, suit: paint('#1f2a4f', 0.6, 0), /** The white-hot core inside an eye or sensor lamp. */ glow_hot: { color: '#eafffb', glow: 2.6 }, import * as THREE from 'three'; export type ViewMode = 'cockpit' | 'chase'; const FLIP = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 1, 0), Math.PI); const _p = new THREE.Vector3(); const _look = new THREE.Matrix4(); const _up = new THREE.Vector3(); /** * Cockpit: the camera sits at the frame's cockpit node, looking along the frame's nose. * Chase (F5): over the frame's right shoulder, so the frame sits left of centre and the crosshair * (screen centre) has clear space. Position follows rigidly; only the orientation is smoothed, so the * frame never drifts toward or away from the camera when it speeds up or slows down. */ export class CameraRig { mode: ViewMode = 'chase'; readonly camera: THREE.PerspectiveCamera; /** Chase offset in the frame's axes (+X is the frame's left, +Z forward). X is set from `shoulder`. */ chaseOffset = new THREE.Vector3(0, 4.5, -30); /** How far over the right shoulder the chase camera sits in flight (negative X is the frame's right). */ shoulder = -8.5; /** How far below the camera the look point sits, so the frame rides low in the view. */ lookDrop = 1.5; /** Scales the chase distance and height. On the catapult a heavy's camera pulls in to the * striker's distance, so it stays near the tube mouth instead of deep in the hangar. */ reach = 1; /** 0 centred behind the frame (on the catapult), 1 fully over the shoulder. Eases toward `shoulderWanted`. */ private shoulderBlend = 0; shoulderWanted = 0; private smoothed = new THREE.Quaternion(); private shake = 0; private time = 0; constructor(fov = 68) { this.camera = new THREE.PerspectiveCamera(fov, 1, 0.5, 60000); } toggle() { this.mode = this.mode === 'cockpit' ? 'chase' : 'cockpit';Bashgrep -n "nozzle" src/render/mech.ts | head -20 && grep -n "NozzleKind" -A 6 src/render/exhaust.ts | head -30 && grep -n "block_" src/render/assets.ts | head; sed -n 396,422p kit/lib.py
command
grep -n "nozzle" src/render/mech.ts | head -20 && grep -n "NozzleKind" -A 6 src/render/exhaust.ts | head -30 && grep -n "block_" src/render/assets.ts | head; sed -n 396,422p kit/lib.py
result, 59 lines
72: readonly nozzles: Nozzle[] = []; 78: /** One plume material per nozzle kind: a kind fires together. */ 100: if (!dir || !/^nozzle/.test(o.name)) return; 103: // the plume's own space is in nozzle radii (render/plume.ts) 111: this.nozzles.push({ node: o, dir: d, radius, kind, plume }); 185: for (const n of this.nozzles) n.plume.visible = plumeVisible(this.exhaust.plumes[n.kind]); 195: for (const n of this.nozzles) { 5:export type NozzleKind = 'main' | 'binder' | 'calf'; 6:export const KINDS: readonly NozzleKind[] = ['main', 'binder', 'calf']; 7- 8-/** One frame's thrusters as the sim reports them. x, y, z: local acceleration (left, up, forward) as 9- * a fraction of boosted forward thrust (FlightState.thrust). */ 10-export interface ThrustReading { 11- x: number; 12- y: number; -- 47:export function levels(r: ThrustReading, out: Record<NozzleKind, number>): Record<NozzleKind, number> { 48- const fwd = Math.max(0, r.z), back = Math.max(0, -r.z), up = Math.max(0, r.y); 49- const side = Math.abs(r.x), vert = Math.abs(r.y); 50- const boost = r.boosting ? 1 : 0; 51- out.main = Math.min(1, Math.max(IDLE, fwd * 1.6 + boost * 0.35)); 52- out.binder = Math.min(1, side * 1.3 + vert * 1.1 + boost * 0.3 * fwd); 53- out.calf = Math.min(1, back * 1.6 + up * 1.2); -- 110: readonly plumes: Record<NozzleKind, Plume> = { main: blank(), binder: blank(), calf: blank() }; 111: private target: Record<NozzleKind, number> = { main: 0, binder: 0, calf: 0 }; 112: private burstDir: Record<NozzleKind, number> = { main: 0, binder: 0, calf: 0 }; 113: private level: Record<NozzleKind, number> = { main: 0, binder: 0, calf: 0 }; 114- private boostAge = Infinity; 115- private assaultAge = Infinity; 116- private wasBoosting = false; 117- private wasAssault = false; 118- private dir: ThrustReading = { x: 0, y: 0, z: 0, boosting: false }; 119- private ign: Ignition[] = [0, 1, 2].map(() => ignition(Infinity, 0)); def cylinder(r, z0, z1, n=10, r1=None, axis="z", at=(0, 0)): """An n-sided cylinder (or cone with r1) between z0 and z1 along an axis, centred at `at` in the other two coordinates.""" r1 = r if r1 is None else r1 return loft([(z0, circle(r, n, *at)), (z1, circle(r1, n, *at))], axis=axis) def nozzle(r_out, length, n=12, flare=1.25): """A thruster bell along -Z from the origin (throat at z=0, exit at z=-length), open-ended with a thick lip. Returns (shell bmesh, glow disc bmesh).""" ro, ri = r_out, r_out * 0.78 rings_out = [(0, circle(ro / flare, n)), (-length * 0.6, circle(ro * 0.92, n)), (-length, circle(ro, n))] rings_in = [(-length, circle(ri, n)), (-length * 0.6, circle(ri * 0.9, n)), (0.0, circle(ri / flare * 0.9, n))] bm = bmesh.new() loops = [] for h, pts in rings_out + rings_in: loops.append([bm.verts.new((u, v, h)) for u, v in pts]) for a, b in zip(loops, loops[1:]): for i in range(n): j = (i + 1) % n bm.faces.new((a[i], a[j], b[j], b[i])) bm.faces.new(list(reversed(loops[0]))) _outward(bm) glow = loft([(-length * 0.15, circle(ri / flare * 0.85, n)), (-length * 0.12, circle(ri / flare * 0.85, n))]) return bm, glowBashsed -n 96,112p src/render/mech.ts; grep -n "glb" src/render/assets.ts | head -12
command
sed -n 96,112p src/render/mech.ts; grep -n "glb" src/render/assets.ts | head -12
result, 26 lines
calf: plumeMaterial(this.exhaustColor, paint.glow ?? 1, 41.7), }; root.traverse((o) => { const dir = o.userData.dir as number[] | undefined; if (!dir || !/^nozzle/.test(o.name)) return; const kind: NozzleKind = /main/.test(o.name) ? 'main' : /binder/.test(o.name) ? 'binder' : 'calf'; const radius = (o.userData.radius as number) ?? 0.5; // the plume's own space is in nozzle radii (render/plume.ts) const plume = new THREE.Mesh(PLUME_HULL, this.plumeMats[kind]); const d = new THREE.Vector3(...(dir as [number, number, number])); plume.quaternion.setFromUnitVectors(new THREE.Vector3(0, 0, 1), d); plume.scale.setScalar(radius); plume.visible = false; plume.renderOrder = 2; o.add(plume); this.nozzles.push({ node: o, dir: d, radius, kind, plume }); }); 20: * Models ship as .glb. Artifact pages serve neither .glb nor fetches of data: URLs, so the artifact 21: * build wraps each model as base64 in JSON (VITE_MODEL_EXT=glb.json) and the page decodes it here. 23: * (.q.glb.json) for a page that can't run the WebAssembly decoder. 25:const EXT: string = import.meta.env.VITE_MODEL_EXT ?? 'glb'; 26:const meshopt: Promise<boolean> = EXT === 'glb' ? Promise.resolve(true) : MeshoptDecoder.ready.then(() => true, () => false); 32: const b64 = (await res.json()).glb as string; 61: p = track(meshopt.then((ok) => fetchGlb(url(ok))).then((glb) => parseModel(glb, merge))); 68:export async function parseModel(glb: ArrayBuffer, merge = true): Promise<THREE.Object3D> { 69: const root = unquantize((await loader.parseAsync(glb, '')).scene);Write~/Projects/sortie-wt/fable52/kit/blocks/_sk.py
input
~/Projects/sortie-wt/fable52/kit/blocks/_sk.py """Sketch helpers over block.Blocks: slabs cut from a side, front or top outline, tapered limbs and turned parts, so a block sketch can carry wedges and sweeps and still build in seconds. Coordinates as in the kit: metres, faces -Y, Z up, left is +X. Sided joints take the left part. A sketch, not a rule set: nothing here is a design decision.""" from mathutils import Matrix, Vector from lib import loft, octo, prism, rot, transform from mech import nozzle_pair class Sketch: def __init__(self, Blocks, joints=None): j = dict(joints or {}) if "hand" in j and "grip" not in j: # the grip rides with the hand h = j["hand"] j["grip"] = (h[0] - .14, h[1] - .02, h[2] - .48) self.b = Blocks(j) self.k = 0 def at(self, name): return self.b.at(name) def box(self, joint, x, y, z, role="main", mirror=False): self.b.box(joint, x, y, z, role, mirror) def side(self, joint, yz, x, role="main", mirror=False): """A slab from a side outline (y, z), between two x.""" self.b._put(joint, prism(yz, x[0], x[1], "yz"), role, mirror) def front(self, joint, xz, y, role="main", mirror=False): """A slab from a front outline (x, z), between two y.""" self.b._put(joint, prism(xz, y[0], y[1], "xz"), role, mirror) def top(self, joint, xy, z, role="main", mirror=False): """A slab from a top outline (x, y), between two z.""" self.b._put(joint, prism(xy, z[0], z[1], "xy"), role, mirror) def rings(self, joint, rings, role="main", mirror=False, chamfer=.15): """A loft through (z, width, depth, x, y) rings.""" self.b.taper(joint, rings, role, mirror, chamfer) def limb(self, joint, a, b, top, bot, role="main", ext=(0, 0), dy=(0, 0), chamfer=.12): """A tapered block from joint a down to joint b: (width, depth) at each end.""" pa, pb = self.at(a), self.at(b) self.b.taper(joint, [(pb.z - ext[1], bot[0], bot[1], pb.x, pb.y + dy[1]), (pa.z + ext[0], top[0], top[1], pa.x, pa.y + dy[0])], role, chamfer=chamfer) def pivot(self, joint, at, size=.5, role="joint"): """A dark block at a joint, so a bend shows a mechanism and not a gap.""" p = self.at(at) self.b.taper(joint, [(p.z - size, size * 1.7, size * 1.7, p.x, p.y), (p.z + size, size * 1.7, size * 1.7, p.x, p.y)], role, chamfer=size * .5) def turned(self, joint, bm, at, turns=(), role="main", mirror=False): """A part built at the origin, turned by (axis, degrees) in order, then moved to `at`.""" m = Matrix.Translation(Vector(at)) for axis, deg in reversed(turns): m = m @ rot(axis, deg) self.b._put(joint, transform(bm, m), role, mirror) return m def blade(self, length, w0, w1, depth): """A tapered slab standing on the origin, pointing up +Z.""" return prism([(-w0 / 2, 0), (w0 / 2, 0), (w1 / 2, length), (-w1 / 2, length)], -depth / 2, depth / 2, "xz") def jets(self, joint, at, direction, r=.5, length=.9, kind="main"): """A nozzle pair that fires in the game. `kind` main, binder or calf picks when it fires.""" self.k += 1 if joint in ("shoulder", "upperarm", "forearm", "thigh", "shin", "foot", "binder"): jl, jr = self.b.nodes[f"{joint}.L"], self.b.nodes[f"{joint}.R"] else: jl = jr = self.b.nodes[joint] nozzle_pair(f"{kind}{self.k}", at, direction, r, length, jl, jr, housing=False) def eye(self, y, z, w=.35, h=.1): """A lit slit on the face, so the head reads and the facing is clear.""" self.b.box("head", (-w, w), (y - .08, y + .04), (z, z + h), "glow_eye")result, 1 line
File created successfully at: ~/Projects/sortie-wt/fable52/kit/blocks/_sk.py (file state is current in your context — no need to Read it back)
Write~/Projects/sortie-wt/fable52/kit/blocks/sk1.py
input
~/Projects/sortie-wt/fable52/kit/blocks/sk1.py """Sketch 1, needle. One idea: all length. Legs past 60 percent, a tiny head, twin tail blades to the knee.""" from blocks._sk import Sketch def build(Blocks): s = Sketch(Blocks, { "pelvis": (0, 0, 11.0), "waist": (0, 0, 11.5), "torso": (0, 0, 12.2), "neck": (0, 0, 15.55), "head": (0, 0, 16.0), "backpack": (0, 1.3, 14.0), "cockpit": (0, -.7, 13.8), "shoulder": (1.7, 0, 14.9), "upperarm": (2.2, 0, 14.7), "forearm": (2.25, 0, 12.4), "hand": (2.25, 0, 10.2), "thigh": (.95, 0, 10.95), "shin": (1.0, 0, 6.3), "foot": (1.0, .1, 1.3), "binder": (.75, 1.9, 14.7)}) # core: a prow chest over a thin waist s.side("torso", [(-1.75, 13.7), (-.9, 15.35), (.9, 15.5), (1.15, 12.5), (-.7, 12.3)], (-1.45, 1.45)) s.side("torso", [(-1.9, 13.55), (-1.75, 14.3), (-1.1, 13.0), (-1.2, 12.7)], (-.5, .5), "accent") s.box("waist", (-.5, .5), (-.45, .5), (11.3, 12.4), "frame") s.front("pelvis", [(-1.25, 11.5), (1.25, 11.5), (.45, 10.2), (-.45, 10.2)], (-.7, .75)) s.box("backpack", (-.85, .85), (1.0, 2.0), (12.9, 15.1), "frame") # head: a small wedge with a crest swept back s.side("head", [(-.62, 16.0), (-.78, 16.55), (-.2, 16.95), (1.45, 17.6), (.75, 16.5), (.5, 16.0)], (-.4, .4)) s.eye(-.72, 16.42, .3) s.box("neck", (-.25, .25), (-.25, .3), (15.4, 16.1), "frame") # shoulders: small blocks with a fin tip rising outward s.front("shoulder", [(1.55, 14.15), (2.85, 14.3), (3.45, 16.1), (2.6, 15.45), (1.55, 15.25)], (-.75, .8)) s.limb("upperarm", "upperarm.L", "forearm.L", (.62, .7), (.5, .55), ext=(-.2, -.25)) s.pivot("forearm", "forearm.L", .3) s.limb("forearm", "forearm.L", "hand.L", (.7, .85), (.5, .55), ext=(-.2, -.1)) s.box("hand", (2.0, 2.5), (-.3, .3), (9.45, 10.1), "frame") # legs: long thigh, a calf blade swept back, a narrow toe s.pivot("thigh", "thigh.L", .42) s.limb("thigh", "thigh.L", "shin.L", (1.0, 1.15), (.72, .8), ext=(-.25, -.5)) s.pivot("shin", "shin.L", .4) s.side("shin", [(-.6, 6.7), (-.48, 1.9), (.75, 1.6), (1.75, 4.9), (.6, 6.9)], (.58, 1.42)) s.box("shin", (.68, 1.32), (-.98, -.45), (5.7, 7.15), "accent") s.side("foot", [(-2.0, 0), (.75, 0), (.75, 1.1), (-.4, 1.55), (-1.75, .5)], (.62, 1.38)) s.side("foot", [(.55, 0), (1.5, 0), (.95, 1.25)], (.75, 1.25), "frame") # the tail: two long blades from the shoulder blades to the knee s.side("binder", [(1.55, 15.3), (2.3, 15.55), (4.9, 8.3), (4.45, 7.9), (1.9, 13.2)], (.52, .98)) s.side("binder", [(3.55, 10.9), (4.02, 11.1), (4.9, 8.3), (4.45, 7.9)], (.46, 1.04), "accent") s.jets("backpack", (.5, 2.0, 13.0), (0, .55, -.83), .5, .9) s.jets("binder", (.75, 4.55, 8.25), (0, .5, -.87), .3, .6, "main")result, 1 line
File created successfully at: ~/Projects/sortie-wt/fable52/kit/blocks/sk1.py (file state is current in your context — no need to Read it back)
Write~/Projects/sortie-wt/fable52/kit/blocks/sk2.py
input
~/Projects/sortie-wt/fable52/kit/blocks/sk2.py """Sketch 2, yoke. One idea: the engines ride a beam across the shoulders and the body hangs from it.""" from blocks._sk import Sketch def build(Blocks): s = Sketch(Blocks, { "neck": (0, -.2, 15.1), "head": (0, -.3, 15.5), "backpack": (0, 1.2, 14.4), "cockpit": (0, -.7, 13.6), "shoulder": (2.5, 0, 14.9), "upperarm": (3.5, 0, 13.9), "forearm": (3.6, 0, 11.6), "hand": (3.6, 0, 9.3), "thigh": (.9, 0, 10.5), "shin": (.95, 0, 6.0), "foot": (1.0, .1, 1.45), "binder": (2.6, 1.2, 15.4)}) # the beam and the keel that hangs from it s.box("torso", (-2.6, 2.6), (-.2, 1.55), (14.3, 15.75)) s.front("torso", [(-1.95, 14.5), (1.95, 14.5), (.7, 11.8), (-.7, 11.8)], (-1.15, .95)) s.front("torso", [(-.9, 14.2), (.9, 14.2), (.35, 12.4), (-.35, 12.4)], (-1.35, -1.1), "accent") s.box("waist", (-.5, .5), (-.45, .45), (10.9, 12.0), "frame") s.front("pelvis", [(-1.2, 11.0), (1.2, 11.0), (.5, 9.7), (-.5, 9.7)], (-.7, .7)) # head: low and wide, sunk under the beam line s.box("head", (-.6, .6), (-1.2, .1), (15.45, 16.35)) s.eye(-1.2, 15.85, .5) # the pods: long, front to back, a cap at the nose, the drive at the tail, a fin on top s.rings("shoulder", [(13.85, 2.1, 3.7, 3.6, .75), (16.25, 2.1, 3.7, 3.6, .75)], chamfer=.5) s.box("shoulder", (2.75, 4.45), (-1.55, -1.05), (14.2, 15.9), "accent") s.side("shoulder", [(.6, 16.2), (2.3, 16.2), (3.0, 17.6), (2.2, 17.6)], (4.25, 4.5)) s.jets("shoulder", (3.6, 2.5, 15.05), (0, 1, -.12), .85, 1.2) # arms hang under the pods, heavy at the wrist s.limb("upperarm", "upperarm.L", "forearm.L", (.75, .8), (.65, .7), ext=(.2, -.25)) s.pivot("forearm", "forearm.L", .34) s.box("forearm", (3.05, 4.15), (-.75, .75), (9.7, 11.3)) s.box("hand", (3.3, 3.9), (-.35, .35), (8.6, 9.5), "frame") # legs: thin on purpose, small feet s.pivot("thigh", "thigh.L", .4) s.limb("thigh", "thigh.L", "shin.L", (.95, 1.05), (.7, .8), ext=(-.25, -.5)) s.pivot("shin", "shin.L", .36) s.limb("shin", "shin.L", "foot.L", (.8, .95), (.6, .7), ext=(-.35, -.2)) s.box("shin", (.6, 1.3), (-.85, -.4), (4.6, 6.6), "accent") s.side("foot", [(-1.5, 0), (.8, 0), (.8, 1.0), (-.3, 1.45), (-1.3, .45)], (.55, 1.45)) s.jets("shin", (.95, .6, 3.4), (0, .8, -.6), .28, .5, "calf")result, 1 line
File created successfully at: ~/Projects/sortie-wt/fable52/kit/blocks/sk2.py (file state is current in your context — no need to Read it back)
Write~/Projects/sortie-wt/fable52/kit/blocks/sk3.py
input
~/Projects/sortie-wt/fable52/kit/blocks/sk3.py """Sketch 3, coat. One idea: a split tail coat of plate from the shoulders to the knee, the drive under the hem.""" from blocks._sk import Sketch def build(Blocks): s = Sketch(Blocks, {"backpack": (0, 1.4, 13.6), "binder": (1.0, 1.7, 15.0), "head": (0, 0, 15.8), "shoulder": (1.9, 0, 14.6), "upperarm": (2.5, 0, 14.3), "forearm": (2.55, 0, 11.9), "hand": (2.55, 0, 9.6)}) # core s.side("torso", [(-1.35, 12.3), (-1.55, 14.4), (-.8, 15.3), (1.0, 15.3), (1.3, 12.2)], (-1.6, 1.6)) s.box("torso", (-.55, .55), (-1.7, -1.45), (12.9, 14.3), "accent") s.box("torso", (-1.25, 1.25), (.45, 1.45), (15.0, 16.35)) # the collar stands behind the head s.box("waist", (-.65, .65), (-.5, .55), (11.0, 12.3), "frame") s.front("pelvis", [(-1.5, 11.1), (1.5, 11.1), (.6, 9.8), (-.6, 9.8)], (-.8, .8)) s.box("pelvis", (.2, 1.4), (-1.2, -.92), (7.9, 10.9), mirror=True) # front tabards match the coat s.box("backpack", (-1.0, 1.0), (.9, 1.7), (11.6, 14.8), "frame") # head in a hood s.side("head", [(-.55, 15.75), (-1.0, 16.55), (-.35, 17.5), (.95, 17.6), (1.3, 16.5), (.9, 15.6)], (-.72, .72)) s.box("head", (-.42, .42), (-.98, -.5), (15.95, 16.75), "frame") s.eye(-.98, 16.35, .34) # shoulders slope down and out into the coat line s.front("shoulder", [(1.4, 15.25), (2.5, 15.2), (3.4, 13.5), (2.8, 13.2), (1.6, 14.1)], (-.95, 1.25)) s.limb("upperarm", "upperarm.L", "forearm.L", (.7, .75), (.6, .65), ext=(-.3, -.25)) s.pivot("forearm", "forearm.L", .32) s.limb("forearm", "forearm.L", "hand.L", (.8, .9), (.65, .7), ext=(-.2, .1)) s.box("hand", (2.3, 2.8), (-.3, .3), (8.85, 9.55), "frame") # the coat: a back panel and a side panel each side, hung from the shoulder blades s.front("binder", [(.14, 15.1), (2.2, 15.5), (3.0, 13.0), (2.7, 7.4), (1.5, 6.0), (.14, 7.6)], (1.95, 2.3)) s.side("binder", [(-.5, 13.1), (2.1, 13.3), (2.2, 7.5), (.7, 6.7), (-.35, 9.4)], (2.72, 3.02)) s.front("binder", [(.14, 8.5), (2.75, 8.2), (2.7, 7.4), (1.5, 6.0), (.14, 7.6)], (1.9, 2.36), "accent") s.jets("backpack", (.62, 1.5, 11.4), (0, .42, -.9), .55, .9) # legs: plain, heavier at the boot s.pivot("thigh", "thigh.L", .42) s.limb("thigh", "thigh.L", "shin.L", (1.05, 1.15), (.8, .9), ext=(-.25, -.5)) s.pivot("shin", "shin.L", .4) s.limb("shin", "shin.L", "foot.L", (.85, 1.0), (1.2, 1.5), ext=(-.4, -.15), dy=(0, .1)) s.box("shin", (.72, 1.68), (-1.0, -.5), (5.3, 6.9), "accent") s.side("foot", [(-1.8, 0), (1.0, 0), (1.0, 1.2), (-.4, 1.6), (-1.6, .55)], (.6, 1.8))result, 1 line
File created successfully at: ~/Projects/sortie-wt/fable52/kit/blocks/sk3.py (file state is current in your context — no need to Read it back)
Write~/Projects/sortie-wt/fable52/kit/blocks/sk4.py
input
~/Projects/sortie-wt/fable52/kit/blocks/sk4.py """Sketch 4, cross. One idea: four drive booms in an X behind a compact body, a light at each tip.""" from mathutils import Vector from blocks._sk import Sketch def build(Blocks): s = Sketch(Blocks, { "pelvis": (0, 0, 10.3), "waist": (0, 0, 10.8), "torso": (0, 0, 11.6), "neck": (0, 0, 14.9), "head": (0, 0, 15.4), "backpack": (0, 1.5, 13.4), "cockpit": (0, -.7, 13.3), "shoulder": (1.9, 0, 14.3), "upperarm": (2.45, 0, 14.0), "forearm": (2.5, 0, 11.8), "hand": (2.5, 0, 9.7), "thigh": (1.1, 0, 10.25), "shin": (1.15, 0, 6.0), "foot": (1.15, .1, 1.5), "binder": (.9, 2.2, 13.9)}) # compact body round a hub s.rings("torso", [(11.9, 2.3, 2.0, 0, 0), (13.2, 3.3, 2.5, 0, -.1), (14.9, 2.9, 2.2, 0, 0)], chamfer=.5) s.box("torso", (-.5, .5), (-1.55, -1.2), (12.6, 14.0), "accent") s.box("waist", (-.6, .6), (-.5, .55), (10.6, 12.0), "frame") s.front("pelvis", [(-1.4, 10.8), (1.4, 10.8), (.55, 9.5), (-.55, 9.5)], (-.8, .8)) s.rings("backpack", [(12.2, 1.9, 1.3, 0, 1.75), (14.6, 1.9, 1.3, 0, 1.75)], "frame", chamfer=.45) # head: small, one fin s.box("head", (-.45, .45), (-.7, .55), (15.35, 16.3)) s.side("head", [(-.3, 16.3), (.5, 16.3), (.95, 17.0), (.5, 17.0)], (-.1, .1), "accent") s.eye(-.7, 15.8, .32) s.box("neck", (-.25, .25), (-.25, .3), (14.8, 15.45), "frame") s.box("shoulder", (1.7, 3.05), (-.8, .8), (13.5, 14.95)) s.limb("upperarm", "upperarm.L", "forearm.L", (.65, .7), (.55, .6), ext=(-.3, -.25)) s.pivot("forearm", "forearm.L", .3) s.limb("forearm", "forearm.L", "hand.L", (.75, .85), (.6, .65), ext=(-.2, .05)) s.box("hand", (2.25, 2.75), (-.3, .3), (9.0, 9.65), "frame") # the booms: upper pair on the binder joints so they swing, lower pair fixed to the pack for joint, hub, lean, length, kind in (("binder", (.9, 2.2, 13.9), 52, 5.4, "main"), ("backpack", (.9, 2.2, 13.0), 132, 4.6, "main")): m = s.turned(joint, s.blade(length, 1.0, .62, .7), hub, (("Y", lean), ("X", -14)), mirror=joint == "backpack") tip = m @ Vector((0, 0, length)) root = m @ Vector((0, 0, length - 1.3)) bm = s.blade(1.3, .78, .7, .86) s.turned(joint, bm, root, (("Y", lean), ("X", -14)), "accent", mirror=joint == "backpack") s.jets(joint, (tip.x, tip.y + .35, tip.z), (0, 1, -.1), .5, .8, kind) # legs: plain with a forward knee s.pivot("thigh", "thigh.L", .42) s.limb("thigh", "thigh.L", "shin.L", (1.05, 1.15), (.8, .9), ext=(-.25, -.5)) s.pivot("shin", "shin.L", .4) s.limb("shin", "shin.L", "foot.L", (.95, 1.1), (.75, .85), ext=(-.4, -.15)) s.side("shin", [(-1.05, 5.4), (-.5, 5.4), (-.5, 7.2), (-.8, 7.4)], (.75, 1.55), "accent") s.side("foot", [(-1.75, 0), (.9, 0), (.9, 1.15), (-.4, 1.6), (-1.55, .5)], (.65, 1.65))result, 1 line
File created successfully at: ~/Projects/sortie-wt/fable52/kit/blocks/sk4.py (file state is current in your context — no need to Read it back)
Write~/Projects/sortie-wt/fable52/kit/blocks/sk5.py
input
~/Projects/sortie-wt/fable52/kit/blocks/sk5.py """Sketch 5, bell. One idea: the legs are the engines. Bell lower legs with the drive in the heel, a small body on top.""" from blocks._sk import Sketch def build(Blocks): s = Sketch(Blocks, { "pelvis": (0, 0, 10.9), "waist": (0, 0, 11.4), "torso": (0, 0, 12.1), "neck": (0, 0, 15.0), "head": (0, 0, 15.45), "backpack": (0, 1.2, 13.8), "cockpit": (0, -.7, 13.6), "shoulder": (1.6, 0, 14.4), "upperarm": (2.05, 0, 14.2), "forearm": (2.1, 0, 12.1), "hand": (2.1, 0, 10.1), "thigh": (1.55, 0, 10.8), "shin": (1.75, 0, 7.0), "foot": (1.75, .2, 1.1), "binder": (.7, 1.7, 14.6)}) # a small upper body on wide hips s.side("torso", [(-1.2, 12.4), (-1.4, 14.0), (-.7, 15.0), (.8, 15.0), (1.0, 12.3)], (-1.3, 1.3)) s.box("torso", (-.45, .45), (-1.5, -1.3), (12.9, 14.0), "accent") s.box("waist", (-.55, .55), (-.45, .5), (11.2, 12.4), "frame") s.front("pelvis", [(-2.3, 11.4), (2.3, 11.4), (1.9, 10.3), (.5, 9.9), (-.5, 9.9), (-1.9, 10.3)], (-.85, .85)) s.box("backpack", (-.75, .75), (.8, 1.6), (12.7, 14.7), "frame") s.side("binder", [(1.5, 14.9), (2.0, 15.0), (3.3, 12.6), (3.0, 12.4), (1.6, 13.6)], (.55, .8)) # short fins only # head: a small block under a tall mast s.box("head", (-.42, .42), (-.65, .5), (15.4, 16.25)) s.side("head", [(.05, 16.25), (.45, 16.25), (.3, 17.6), (.15, 17.6)], (-.09, .09), "accent") s.eye(-.65, 15.8, .3) s.box("neck", (-.22, .22), (-.22, .28), (14.9, 15.5), "frame") s.box("shoulder", (1.45, 2.6), (-.7, .7), (13.7, 15.0)) s.limb("upperarm", "upperarm.L", "forearm.L", (.55, .6), (.48, .52), ext=(-.3, -.22)) s.pivot("forearm", "forearm.L", .27) s.limb("forearm", "forearm.L", "hand.L", (.62, .7), (.5, .55), ext=(-.18, .05)) s.box("hand", (1.88, 2.32), (-.26, .26), (9.5, 10.05), "frame") # legs: a short thigh, then the bell s.pivot("thigh", "thigh.L", .5) s.limb("thigh", "thigh.L", "shin.L", (1.2, 1.3), (1.0, 1.1), ext=(-.3, -.55)) s.pivot("shin", "shin.L", .48) s.rings("shin", [(1.0, 2.7, 3.5, 1.75, .55), (2.2, 2.6, 3.3, 1.75, .5), (5.2, 1.5, 1.7, 1.75, .1), (6.6, 1.25, 1.4, 1.75, 0)], chamfer=.55) s.rings("shin", [(1.25, 2.82, 3.62, 1.75, .55), (1.95, 2.76, 3.5, 1.75, .52)], "accent", chamfer=.58) s.box("shin", (1.25, 2.25), (-1.05, -.5), (6.2, 7.6), "accent") s.box("foot", (.85, 2.65), (-1.5, 1.3), (0, .95), "frame") s.side("foot", [(-2.1, 0), (-1.4, 0), (-1.4, .95), (-1.9, .4)], (1.05, 2.45)) s.jets("shin", (1.75, 2.15, 2.1), (0, .8, -.6), 1.0, 1.3)result, 1 line
File created successfully at: ~/Projects/sortie-wt/fable52/kit/blocks/sk5.py (file state is current in your context — no need to Read it back)
Write~/Projects/sortie-wt/fable52/kit/blocks/sk6.py
input
~/Projects/sortie-wt/fable52/kit/blocks/sk6.py """Sketch 6, hunch. One idea: the head sits low in a humped back, the arms reach the knee, one big drive behind.""" from blocks._sk import Sketch def build(Blocks): s = Sketch(Blocks, { "pelvis": (0, 0, 9.4), "waist": (0, 0, 9.9), "torso": (0, 0, 10.7), "neck": (0, -1.0, 14.5), "head": (0, -1.3, 14.9), "backpack": (0, 2.0, 13.4), "cockpit": (0, -1.0, 13.0), "shoulder": (2.5, 0, 14.9), "upperarm": (3.35, 0, 14.5), "forearm": (3.6, 0, 11.2), "hand": (3.6, 0, 7.7), "thigh": (1.35, 0, 9.3), "shin": (1.5, 0, 5.4), "foot": (1.5, .1, 1.4), "binder": (.8, 2.4, 15.6)}) # the trunk leans forward and rises to a hump behind the head s.side("torso", [(-1.6, 11.0), (-2.1, 13.9), (-1.0, 15.3), (1.5, 16.6), (2.4, 13.4), (1.3, 10.8)], (-2.0, 2.0)) s.side("torso", [(-2.3, 13.7), (-1.15, 15.25), (-.9, 14.6), (-1.9, 13.2)], (-1.3, 1.3), "accent") s.box("waist", (-.8, .8), (-.6, .7), (9.7, 11.1), "frame") s.front("pelvis", [(-1.8, 10.0), (1.8, 10.0), (.7, 8.5), (-.7, 8.5)], (-.9, .9)) # head: small, forward, under the hump line s.box("head", (-.5, .5), (-2.2, -1.1), (14.85, 15.7)) s.eye(-2.2, 15.2, .4) # shoulders and the long arms s.rings("shoulder", [(13.8, 2.1, 2.5, 3.45, 0), (15.6, 2.3, 2.7, 3.45, 0), (16.3, 1.5, 1.9, 3.3, 0)], chamfer=.5) s.limb("upperarm", "upperarm.L", "forearm.L", (1.0, 1.1), (.85, .95), ext=(-.4, -.35)) s.pivot("forearm", "forearm.L", .45) s.limb("forearm", "forearm.L", "hand.L", (1.0, 1.1), (1.3, 1.5), ext=(-.3, .15)) s.side("forearm", [(-1.35, 11.9), (1.15, 11.9), (1.35, 7.5), (0, 6.3), (-1.35, 7.5)], (4.25, 4.6), "accent") s.box("hand", (3.2, 4.0), (-.5, .5), (6.6, 7.6), "frame") # legs: short, thick, wide feet s.pivot("thigh", "thigh.L", .5) s.limb("thigh", "thigh.L", "shin.L", (1.3, 1.45), (1.05, 1.15), ext=(-.3, -.55)) s.pivot("shin", "shin.L", .48) s.limb("shin", "shin.L", "foot.L", (1.15, 1.3), (1.35, 1.6), ext=(-.45, -.15)) s.box("shin", (.95, 2.05), (-1.1, -.55), (4.6, 6.2), "accent") s.side("foot", [(-2.1, 0), (1.2, 0), (1.2, 1.25), (-.4, 1.6), (-1.85, .6)], (.75, 2.25)) # one big drive, and two stacks up the hump s.rings("backpack", [(12.0, 2.6, 1.6, 0, 2.6), (14.6, 2.6, 1.6, 0, 2.6)], "frame", chamfer=.5) s.jets("backpack", (.62, 3.3, 12.3), (0, .7, -.7), .85, 1.2) s.side("binder", [(1.9, 15.0), (2.7, 15.2), (3.2, 17.6), (2.7, 17.6)], (.55, 1.05))result, 1 line
File created successfully at: ~/Projects/sortie-wt/fable52/kit/blocks/sk6.py (file state is current in your context — no need to Read it back)
Bashtime npm run -s kit -- block_sk1 block_sk2 block_sk3 block_sk4 block_sk5 block_sk6 2>&1 | grep -v "^$" | tail -25
command
time npm run -s kit -- block_sk1 block_sk2 block_sk3 block_sk4 block_sk5 block_sk6 2>&1 | grep -v "^$" | tail -25
result, 29 lines
18:39:28 | INFO: Primitives created: 1 18:39:28 | INFO: Extracting primitive: block9_forearm.L.001 18:39:28 | INFO: Primitives created: 1 18:39:28 | INFO: Extracting primitive: block10_forearm.L.001 18:39:28 | INFO: Primitives created: 1 18:39:28 | INFO: Extracting primitive: block11_forearm.L.001 18:39:28 | INFO: Primitives created: 1 18:39:28 | INFO: Extracting primitive: block12_hand.L.001 18:39:28 | INFO: Primitives created: 1 18:39:28 | INFO: Extracting primitive: block7_shoulder.R.001 18:39:28 | INFO: Primitives created: 1 18:39:28 | INFO: Extracting primitive: block8_upperarm.R.001 18:39:28 | INFO: Primitives created: 1 18:39:28 | INFO: Extracting primitive: block9_forearm.R.001 18:39:28 | INFO: Primitives created: 1 18:39:28 | INFO: Extracting primitive: block10_forearm.R.001 18:39:28 | INFO: Primitives created: 1 18:39:28 | INFO: Extracting primitive: block11_forearm.R.001 18:39:28 | INFO: Primitives created: 1 18:39:28 | INFO: Extracting primitive: block12_hand.R.001 18:39:28 | INFO: Primitives created: 1 18:39:28 | INFO: Finished glTF 2.0 export in 0.10629010200500488 s kit: block_sk6 -> ~/Projects/sortie-wt/fable52/public/assets/block_sk6.glb (160 KB, 0.3s) Blender 5.2.3 LTS (hash e13b728c6880 built 2026-10-22 01:35:05) Blender quit real 0m4.365s user 0m4.339s sys 0m3.964s