**Use for**: a car, coupe, GT or concept vehicle in the scene, built from a reference sheet as editable custom meshes with brushed-metal, glass and lamp shaders; or a vehicle built part by part (a horse-drawn coach, a cart, a wagon, a sled) with the parts kit below, `references/parts-kit.md`. **Status**: the car build is verified on its own (studio scene, Play); a stagecoach built with the parts kit is verified on a moving road in Play, pulled by the animal sub-skill's horses; placing a car o...
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Vehicle?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/josazar-vehicle)
<!-- sub-skill of endless-scene: read ../../SKILL.md first (shared rules, build order) -->
# Sub-skill: vehicle (a procedural car, carriage or cart for the road)
**Use for**: a car, coupe, GT or concept vehicle in the scene, built from a reference sheet as editable custom meshes
with brushed-metal, glass and lamp shaders; or a vehicle built part by part (a horse-drawn coach, a cart, a wagon, a
sled) with the parts kit below, `references/parts-kit.md`. **Status**: the car build is verified on its own (studio
scene, Play); a stagecoach built with the parts kit is verified on a moving road in Play, pulled by the animal
sub-skill's horses; placing a car on the moving road is written from the conventions below and not yet verified.
## On the road
Both builds share one convention: +X to the nose, +Y up, 50 Spline units per metre, origin on the ground under the
middle of the car. The road's `Vehicle Anchor` sits at that origin in the right lane.
1. **Design and tune the car first** with the steps below, ideally in its own file (studio light makes its shapes and
materials easy to judge). Keep the design file: the road scene is rebuilt from it, not copied by hand.
2. **In the road file, build the car before the road.** Remove `drive` from the design (the road moves, not the car),
emit at the origin (`--origin 0,0,0`) and send every recipe, `finish` included: it builds the wheel hierarchy
(`<prefix>Hub` and `<prefix>Spin` groups) as well as a studio. Then remove the studio floor (`<prefix>Studio Floor`),
and turn off what the road does not want (`sky('none')` for the studio HDRI, `fx('bloom', 'none')`). Now build the
road: its stage recipe resets the background, fog, sun and Play camera. Last, move the car's group into `Vehicle
Anchor` by handle (`moveInto(select(o => o.name === 'Vehicle Anchor')[0], ...)`) and read the tree back.
3. **One document**: the scene has a single HTML content. Merge the car's shader document and the road's ride script
into it, each in its own scope, and keep both load checks.
4. **Wheels turn with the road**: spin each wheel's spin group about its axle at `speedKmh / 3.6 / tyreRadius` radians
per second, from the same clock as the road (rule 3 of the main skill), so they freeze with it.
5. **Light**: the car's shaders reflect a baked studio, not the scene. Under the road's sun, retune the design's look
(`look.studio`, `look.env`) toward the road's sky and ground colours, and check paint and glass from the Play
camera at the road's aspect ratio.
6. **Shadow**: the road's sun casts the car's shadow on the asphalt; the car's contact shadow plane can stay for
the soft contact under the tyres.
<!-- end of sub-skill header: below is synced from the standalone vehicle skill, edit it there -->
Builds a car the way a designer's tape drawing does: hard points in metres (length, axles, tyres, belt, roof), the
body as a **station table** along the length, a shape-preserving cubic between stations, wheel openings cut from the
lower edge, then the details that sell a car. Scripts turn a design file into `run_code` recipes (~140 named,
editable custom meshes, 12 shared materials, about 83k vertices) and an HTML-content document with custom shaders
(brushed metal, glass with a fake interior, LED lamps) and optional driving.
Works with any agent that can run shell commands (Node 18+; Python with Pillow for the optional PNG overlay) and
call the Spline MCP. Tool names below are the MCP's (`run_code`, `get_scene_mcp`, `edit_html_content`...); clients
may prefix them (`3d_run_code`). Load the MCP's guides first: `load_skill` "authoring-guide", "-2", "-3", and
"html-content" before the shader step.
| File | Use |
|---|---|
| `scripts/designs/neo-retro-gt.json` | a complete design (a 4.55 m wedge GT): copy it, change the numbers |
| `scripts/emit.mjs` | design -> recipes + `shaders.html`: `node scripts/emit.mjs design.json out/ --origin x,y,z [--pack \| --only "Name\|Name"]` |
| `scripts/check.mjs` | offline check of the design, recipes and document; run before every send (`--final` at the end) |
| `scripts/overlay.mjs`, `overlay_png.py` | the design's lines and glass over the reference (SVG, or PNG with `--crop`/`--zoom`) |
| `scripts/lib.mjs`, `shaders.mjs`, `drive.mjs` | geometry, shader document, drive module (the recipes and document contain this code) |
| `references/design-format.md` | every field of a design, how to measure it, the shader look |
| `references/findings.md` | why: what was measured, the traps behind the rules below |
| `scripts/parts/`, `references/parts-kit.md` | a vehicle built part by part (carriage, cart, wagon): kit, example, build, preview, audit |
## Not a car? Build it part by part
A carriage, a cart, a wagon or a sled has no body loft: it is an open running gear, spoked wheels, springs and a box,
each part visible. Use the parts kit (`references/parts-kit.md`): a parts list with a motion role per mesh, hard points
in `hardpoints.js`, one part file per assembly, then `node scripts/parts/build.mjs <design> <out> --origin x,y,z`
(recipes, offline check), `preview.py` (fit the side view over the reference, look from the top too) and `audit.py`
(nothing floats, nothing sinks, the steered set clears the body at full lock). Start from `scripts/parts/example-wagon`.
Send each recipe as one `run_code` call, then `99-finish.js`, then set the pivots by hand (below, "A car that drives").
## The one idea: numbers first, mesh second
A car reads as real when its proportions are right and its surfaces never wobble, so the body is **tabulated**, not
modelled: each station (a cross-section at x metres) gives half-widths and heights of the deck, shoulder crease,
lower edge and sill. A monotone (Fritsch-Carlson) cubic joins stations without overshoot, so nothing bulges between
them. Every section has the same samples, so sample `s` runs along the same crease the whole length, and a panel,
a pane, a pod or a shut line is a range of `x` and `s`: ranges, not new geometry.
## Build it (offline, then 4 run_code calls and one document)
1. **Reference.** A pure side view plus front and rear three-quarters of the same car, plain background. If there is
none, offer to generate one (the user's image tool; ask before spending credits).
2. **Measure** the side view in px (tail, nose, ground, wheel centres and radii, belt, roof, sill, crease, shut
lines); `scale = (nose - tail) / length`. Write the design: copy the example, keep its layouts, replace numbers.
3. **Overlay** (`overlay.mjs` or `overlay_png.py --scale S --origin X,Y`) and fix rows until the red body, blue
cabin, cyan glass and green wheel lines sit on the picture. Trust it over anyone's eye, including a judge's.
4. **Emit** at the anchor from `get_scene_mcp` with `--pack`, then `node scripts/check.mjs design.json out/`.
5. **Send** `1-...` to `4-finish` in order, each file's content as ONE `run_code` call, verbatim; compare each
reported object count with the check's.
6. **Shaders**: `set_html_content` with `out/shaders.html`. They run in Play, Preview and exports (the editor keeps
the layered materials); a red banner in Play names a part that did not take its shader.
7. **Look** from the reference's three angles in Play, compare crops side by side, then the live check.
## Change it fast
- **Edit the design or the scripts, never a recipe or the document**; re-emit and check (the check fails stale files).
- **Rebuild only what changed**: `emit.mjs ... --only "Canopy|Side Window|Rear Louvres"` writes `1-remove.js`
(exactly those objects, names computed offline: `GT Wheel ` would also catch the liners by hand), `2-rebuild.js`,
`3-finish.js` (it regroups). Changed a recipe material's colour? `deleteMaterial('GT <key>')` first: recipes reuse
an existing asset by name.
- **Look-only changes** (`shaders.look`, lamps' glow...) need no rebuild: apply the diff between the old and new
`shaders.html` as a few find-and-replace edits (`edit_html_content`). Each edit restarts Play: batch them.
- **Verify in Play**: `stop()` and `play()` as two calls, then one capture (the document boots only when Play
renders). A capture right after an edit can be mid-load: take a second before calling anything broken. For several
views in one run, have the document move the camera and grab its own canvas.
- **Measure before changing**: a shape the side overlay already matches is wrong in plan or section: crop the
reference's three-quarter view and name each flat facet before touching a station. A surface that looks wrong:
tint the suspect part to find which one is really visible before tuning it.
## Rules that cost a round trip each time they were missed
1. **run_code stops at 1M loop iterations per call.** The loft caches sections on a 5 mm grid; the check fails a
recipe above 700k. Recipes carry only the functions and design keys they use.
2. **Custom shader materials get no environment reflections** (a metallic one reads black): the shaders reflect a
baked studio (`look.studio`, `look.env`); `lights = false` on a node material drops that too. With PBR paint set
`studio.hdriLighting: false` (the HDRI tints custom materials) and a low `studio.key` (~0.15, or the upper flanks
blow out); give wheel metals `look.metals`.
3. **Captures**: closer than ~150 units a private capture clips near surfaces (a tyre looked shredded); about 8
captures per task, then refused for a while.
4. **DSL quirks**: `color()` on a part linked to a material asset recolours the asset (tint with `updateMaterial`
and restore); a read in the same call as a write sees the scene before it; `o.visible` stays stale after `show()`.
5. **Studio**: a seamless floor needs `studio.fog`; keep the key high (`keyPos`); `contactShadow` grounds the car.
6. **Keep the gasket and the liners**: shut lines read only over the black skin under the panels; liners close the
view into the body through the arches.
7. **Wheels must fit the measured body**: tyre >= 8 mm inside a spat, arch clear at 28 degrees of lock, at most 30 mm
proud, touching the ground (all checked). When a critic asks for bigger or wider wheels, the measurement wins.
8. **Play orbit pivots where the editor view was when the camera was added**: `finish` frames the car from
`studio.playCamera` before `add`, and the check keeps `playCamera.at` on the car's centre. Orbit also re-aims
scripted camera moves: `playControls('none')` for scripted views.
9. **Tune the look by numbers**: luminance percentiles of car and background against the reference per view
(design-format, Shader look). A polished metal needs contrast (`look.metals.*.contrast`), not brightness: a
brighter, sharper lip in an even studio reads as a whitewall.
10. **New features get a check**: a folded pod that could sink into the body, a lamp or bezel outside its end face.
Mutation-test each new check once (inject the bug, see it fail).
## A car that drives (optional `drive` block)
Add `"drive": {}` (fields in design-format) and re-emit: `finish` builds wheel groups (`Hub`, `Spin`) and the body
group, and the document gains a Drive button (WASD or arrows, Space brake, R reset, M mute, Esc stop), a sprung
body with bump stops, an orbit/chase camera and an engine sound. The document is the camera's only driver: leave
`playControls` off. Over the bridge no key can be pressed: set `window.GT_AUTO = { throttle, steer, hand }` from a
temporary script, read the groups back with `findObjectByName`, grab frames, remove the script; then ask the user
to confirm steering, drag orbit and sound.
Adding motion to a vehicle built by hand, or one whose axle turns as a whole (a cart, a carriage, a trailer):
- **Tag every part before modelling**: sprung (rides with the body), unsprung (stays with the axles) or steered.
One mesh, one tag; regroup by tag. A plate bolted to the body but meshed with an axle part slides on the body.
- **Give each moving group its pivot explicitly**: move the group to the pivot (axle centre, kingpin), then set its
children back to their local offsets. A whole axle turning on a kingpin is one group, bolts and springs included;
wheels outside it are rotated about the kingpin in code and take rotation (0, steer, -spin).
- **Measure what the drive reaches**: drag caps the speed below `topSpeed`; read speed, yaw and wheel angle from an
autopilot run. Measure the frame time parked and moving: they differ (findings, Driving).
## When it goes wrong
Bulge between stations -> a station row is off (overlay). Tyre through the body -> `halfTrack`/`width` (check). No
dark lines at doors -> gasket missing or `panels.gap` 0. Car reads black -> rule 2. Glass a black block or absent ->
`glassSide` parts missing (re-emit) or `glassSide.through` too dark/bright. Cabin reads as a clear bubble -> panes
wrap the roof edge: start them at `roofEdge+2`, rear glass only between the pillars. Rear reads like a tube ->
`wrap` the haunch pod and taper the stations behind its crease. Fold shows as a staircase -> re-emit (each row gets
a crease column). Vents grey -> a lens over an opening (only emissive lamps get one). Wheel lip a whitewall ->
`contrast` (rule 9). Raised pod does not read -> `flat: true`. Upper flanks white or a cyan tail -> rule 2. Brushing
like wood grain -> lower `brush` frequencies. Car floats -> `contactShadow`. Interior or shadow left behind while
driving -> a shader reads `positionWorld` (use `positionLocal`). Spins on the spot -> lower `drive.grip`. A fitting slides on the
body when it bounces -> it is meshed or grouped with the axles (tags). Slower only while moving -> shadow-casting
point lights. Wood grain or brushing runs across a beam -> its UVs follow world axes, not its length. "Loop budget
exceeded" -> rule 1. Part in the wrong colour after a test -> rule 4.