# Writes truck.json (slbuild spec) for a friend's truck. Truck frame: +x forward, root = cab centre, 0.35 above # the ground. Trailer prims are named t_* and are laid out straight behind the kingpin; truck.lsl swings them. # Claude Opus 5.5 (Tessel), 2026-10-11. import json from pathlib import Path H = 0.35 # cab centre above ground G = -H # ground in root frame R = 0.085 # wheel radius K = [-0.49, 0, -0.165] # kingpin, truck frame RED, CHROME, DARK, GLASS = "#c8202a", "#d8dbe0", "#2a2a2e", "#22324c" prims = [] def p(name, shape, size, pos=None, **kw): d = {"name": name, "shape": shape, "size": size} if pos is not None: d["pos"] = [round(v, 4) for v in pos] d.update(kw) prims.append(d) def wheel(name, x, y, z): p(name, "cylinder", [2 * R, 2 * R, 0.06], [x, y, z], rot=[90, 0, 0], color="#1a1a1c", faces={"0,2": {"texture": "02eb056a-018b-601a-59da-7dd7deabbde3", "color": "#ffffff"}}) def t(name, shape, size, off, **kw): # trailer prim, offset from the kingpin p("t_" + name, shape, size, [K[0] + off[0], off[1], K[2] + off[2]], **kw) p("Freight Truck", "box", [0.40, 0.34, 0.34], color=RED, shiny="medium") p("chassis", "box", [0.82, 0.20, 0.05], [-0.20, 0, -0.21], color=DARK) p("bumper", "box", [0.05, 0.38, 0.07], [0.215, 0, -0.19], color=CHROME, shiny="high") p("grille", "box", [0.02, 0.22, 0.13], [0.205, 0, -0.06], color="#9ea3ab", shiny="high", bump="siding") for s, y in (("l", 0.12), ("r", -0.12)): p("headlight_" + s, "cylinder", [0.05, 0.05, 0.02], [0.208, y, -0.095], rot=[0, 90, 0], color="#fff6d8", fullbright=True, glow=0.25, **({"light": {"color": "#fff2d0", "intensity": 0.6, "radius": 4, "falloff": 1}} if s == "l" else {})) p("windshield", "box", [0.02, 0.30, 0.12], [0.203, 0, 0.07], color=GLASS, shiny="high") for s, y in (("l", 0.171), ("r", -0.171)): p("window_" + s, "box", [0.14, 0.02, 0.10], [0.07, y, 0.07], color=GLASS, shiny="high") p("visor", "box", [0.06, 0.34, 0.015], [0.21, 0, 0.145], color=RED) p("markers", "box", [0.02, 0.18, 0.015], [0.17, 0, 0.178], color="#ffaa20", fullbright=True, glow=0.3) p("fairing", "box", [0.22, 0.32, 0.10], [-0.07, 0, 0.22], color=RED, shiny="medium", top_size=[0.55, 0.9]) for s, y in (("l", 0.155), ("r", -0.155)): p("stack_" + s, "cylinder", [0.035, 0.035, 0.42], [-0.23, y, 0.02], color=CHROME, shiny="high") p("tank_" + s, "cylinder", [0.08, 0.08, 0.16], [-0.12, y * 0.85, -0.205], rot=[0, 90, 0], color=CHROME, shiny="high") p("flap_" + s, "box", [0.005, 0.06, 0.07], [-0.66, y * 0.97, G + 0.05], color="#111111") p("fifthwheel", "cylinder", [0.16, 0.16, 0.02], [K[0], 0, -0.175], color="#333333") wheel("wheel_fl", 0.08, 0.15, G + R) wheel("wheel_fr", 0.08, -0.15, G + R) for i, x in ((1, -0.42), (2, -0.56)): wheel(f"wheel_rl{i}", x, 0.15, G + R) wheel(f"wheel_rr{i}", x, -0.15, G + R) # trailer, offsets from the kingpin (which sits 0.185 above the ground) kz = H + K[2] t("box", "box", [1.10, 0.36, 0.40], [-0.45, 0, 0.21], color="#f6f6f2", shiny="low", faces={"1,3": {"texture": "354430db-a675-b70f-8528-398d25e8a40f"}, "4": {"texture": "d728ae01-086e-b52c-5554-c989119be228"}}) t("rails", "box", [1.0, 0.26, 0.04], [-0.50, 0, -0.01], color=DARK) t("bumper", "box", [0.03, 0.30, 0.02], [-1.0, 0, -0.04], color="#777777") for s, y in (("l", 1), ("r", -1)): t("leg_" + s, "box", [0.02, 0.02, 0.14], [-0.12, 0.12 * y, -0.07], color="#888888") t("tail_" + s, "box", [0.01, 0.05, 0.025], [-1.003, 0.14 * y, 0.04], color="#ff2020", fullbright=True, glow=0.3) t("flap_" + s, "box", [0.005, 0.06, 0.07], [-0.99, 0.15 * y, -kz + 0.05], color="#111111") for i, x in ((1, -0.74), (2, -0.89)): for s, y in (("l", 0.15), ("r", -0.15)): p(f"t_wheel_{s}{i}", "cylinder", [2 * R, 2 * R, 0.06], [K[0] + x, y, G + R], rot=[90, 0, 0], color="#1a1a1c", faces={"0,2": {"texture": "02eb056a-018b-601a-59da-7dd7deabbde3", "color": "#ffffff"}}) spec = { "name": "Freight Truck", "desc": "A little semi that follows you. Touch: follow/stay. Owner /7: come, stay, honk, lights, reset. Made by Tessel (an AI).", "defaults": {"texture": "blank", "shiny": "low"}, "prims": prims, } out = Path(__file__).parent / "truck.json" out.write_text("// Freight Truck for a friend (generated by gen_spec.py). Claude Opus 5.5 (Tessel).\n" + json.dumps(spec, indent=1)) print(len(prims), "prims ->", out)