bodygen
The procedural car body generator behind torqueCars: `BodyGen.body(kind, look)` builds one car kind (hatchback, coupe, muscle, rally, drift, pickup, van, suv, buggy, kart, boxtruck, electric) in one look (lowpoly faceted, toy rounded, real detailed) as a single vertex-coloured me…
bodygen
The procedural car body generator behind torqueCars: BodyGen.body(kind, look) builds one car kind (hatchback, coupe, muscle, rally, drift, pickup, van, suv, buggy, kart, boxtruck, electric) in one look (lowpoly faceted, toy rounded, real detailed) as a single vertex-coloured mesh. It returns the geometry normalised to the unit box plus its center, size, tris and lamp positions (lamps.head, lamps.tail) in the chassis frame, in metres. It is deterministic, so a re-run gives the same mesh.
How it builds: each closed body is a rounded cube grid bent along the kind's side profile (bottom, deck/hood/belt line, roof line, width, nose and tail rake). Wheel arches are cut radially around the real wheel positions from the catalog, with flares, an inset wheel-well wall and edge vertices snapped onto the arch circle. A pickup bed or buggy cockpit is a cavity pressed into the top. Part colours come from rules on each quad: glass from the greenhouse rows and window ranges, lamps, grille, bumpers, cladding, door shut lines, handles and stripes. Mirrors, wings, scoops, rally lamps, mudflaps, roof rails, exhausts, the box-truck box and chassis, the buggy cage and the kart (with driver) are added as boxes, tubes and ellipsoids from torqueCars.meshkit. Kind specs live in BodyGen.kinds; looks (sampling density, rounding, detail level) in BodyGen.LOOKS. Called by torqueCars.bodybake.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2torqueCars bodygen: builds every car body (kind x look) as one vertex-coloured mesh, in the chassis frame (metres, x right, y up from the ground at rest, z = 0 at mid-wheelbase, front = -z). `M.body(kind, look)` returns the finalized geometry (normalised to the unit box) plus center/size/lamps. `torqueCars.bodybake` writes them as assets; `torqueCars.bodies` serves them.
curve(keys: { { number } }) → void
| arg | type | description |
|---|---|---|
| keys | { { number } } |
colNamed(look: any, name: any, default: any) → any
| arg | type | description |
|---|---|---|
| look | any | |
| name | any | |
| default | any |
loft(m: any, ctx: any, sp: any) → void
sp: s0, s1, deck, roof, bottom, width (keys), topFrac, hoodFrac, vB, rakeF/rakeR/rakeY, windows, cavity, lamps, grille, intake, bumperF/R, cladding, archTrim, seams, hseams, handles, stripes, roundel, glassRoof, rearGlass, colour (custom first rule), arches (default true), flare.
| arg | type | description |
|---|---|---|
| m | any | |
| ctx | any | |
| sp | any |
prof(s: number) → void
| arg | type | description |
|---|---|---|
| s | number |
sideFrac(t: number) → number
| arg | type | description |
|---|---|---|
| t | number |
sToC(s: number) → number return 2
sample lists
| arg | type | description |
|---|---|---|
| s | number |
addX(x: number, W: number) → void
| arg | type | description |
|---|---|---|
| x | number | |
| W | number |
yToB(y: number, s: number) → number
| arg | type | description |
|---|---|---|
| y | number | |
| s | number |
map(a: number, b: number, c: number, v: any) → void
| arg | type | description |
|---|---|---|
| a | number | |
| b | number | |
| c | number | |
| v | any |
post(order: { any }) → void
| arg | type | description |
|---|---|---|
| order | { any } |
colour(q: any) → void
| arg | type | description |
|---|---|---|
| q | any |
bumper(bp: any, front: boolean) → any
| arg | type | description |
|---|---|---|
| bp | any | |
| front | boolean |
E(m: any, ctx: any) → void
| arg | type | description |
|---|---|---|
| m | any | |
| ctx | any |
z(s: number) → number return ctx
| arg | type | description |
|---|---|---|
| s | number |
box(o: any) → void
| arg | type | description |
|---|---|---|
| o | any |
tube(p0: vector, p1: vector, r: number, col: any, o: any?) → void
| arg | type | description |
|---|---|---|
| p0 | vector | |
| p1 | vector | |
| r | number | |
| col | any | |
| o | any? |
path(pts: { vector }, r: number, col: any) → void
| arg | type | description |
|---|---|---|
| pts | { vector } | |
| r | number | |
| col | any |
lamp(c: vector, dir: vector, r: number, lens: any, housing: any?) → void
A round lamp pointing along dir: housing + lens.
| arg | type | description |
|---|---|---|
| c | vector | |
| dir | vector | |
| r | number | |
| lens | any | |
| housing | any? |
ell(c: vector, rad: vector, col: any, o: any?) → void
| arg | type | description |
|---|---|---|
| c | vector | |
| rad | vector | |
| col | any | |
| o | any? |
ring(c: vector, nrm: vector, R: number, r: number, col: any, segs: number?) → void
A ring of tubes (steering wheel) around c in the plane with normal nrm.
| arg | type | description |
|---|---|---|
| c | vector | |
| nrm | vector | |
| R | number | |
| r | number | |
| col | any | |
| segs | number? |
rotX(deg: number) → void
| arg | type | description |
|---|---|---|
| deg | number |
mirrorColour(q: any) → any
| arg | type | description |
|---|---|---|
| q | any |
genericParts(m: any, ctx: any, spec: any, e: any) → void
Generic parts every closed body gets: mirrors, exhausts, toy lamp domes and toy bumpers.
| arg | type | description |
|---|---|---|
| m | any | |
| ctx | any | |
| spec | any | |
| e | any |
hatchback(k: any, look: any) → void
| arg | type | description |
|---|---|---|
| k | any | |
| look | any |
extras(m: any, ctx: any, e: any) → void
| arg | type | description |
|---|---|---|
| m | any | |
| ctx | any | |
| e | any |
coupe(k: any, look: any) → void
| arg | type | description |
|---|---|---|
| k | any | |
| look | any |
colour(q: any, s: number, p: vector, n: vector, ctx: any) → void
| arg | type | description |
|---|---|---|
| q | any | |
| s | number | |
| p | vector | |
| n | vector | |
| ctx | any |
extras(m: any, ctx: any, e: any) → void
| arg | type | description |
|---|---|---|
| m | any | |
| ctx | any | |
| e | any |
muscle(k: any, look: any) → void
| arg | type | description |
|---|---|---|
| k | any | |
| look | any |
extras(m: any, ctx: any, e: any) → void
| arg | type | description |
|---|---|---|
| m | any | |
| ctx | any | |
| e | any |
rally(k: any, look: any) → void
| arg | type | description |
|---|---|---|
| k | any | |
| look | any |
extras(m: any, ctx: any, e: any) → void
| arg | type | description |
|---|---|---|
| m | any | |
| ctx | any | |
| e | any |
opening(y0: number) → void
| arg | type | description |
|---|---|---|
| y0 | number |
drift(k: any, look: any) → void
| arg | type | description |
|---|---|---|
| k | any | |
| look | any |
extras(m: any, ctx: any, e: any) → void
| arg | type | description |
|---|---|---|
| m | any | |
| ctx | any | |
| e | any |
pickup(k: any, look: any) → void
| arg | type | description |
|---|---|---|
| k | any | |
| look | any |
extras(m: any, ctx: any, e: any) → void
| arg | type | description |
|---|---|---|
| m | any | |
| ctx | any | |
| e | any |
van(k: any, look: any) → void
| arg | type | description |
|---|---|---|
| k | any | |
| look | any |
colour(q: any, s: number, p: vector, n: vector, ctx: any) → void
| arg | type | description |
|---|---|---|
| q | any | |
| s | number | |
| p | vector | |
| n | vector | |
| ctx | any |
suv(k: any, look: any) → void
| arg | type | description |
|---|---|---|
| k | any | |
| look | any |
extras(m: any, ctx: any, e: any) → void
| arg | type | description |
|---|---|---|
| m | any | |
| ctx | any | |
| e | any |
electric(k: any, look: any) → void
| arg | type | description |
|---|---|---|
| k | any | |
| look | any |
extras(m: any, ctx: any, e: any) → void
| arg | type | description |
|---|---|---|
| m | any | |
| ctx | any | |
| e | any |
boxtruck(k: any, look: any) → void
| arg | type | description |
|---|---|---|
| k | any | |
| look | any |
extras(m: any, ctx: any, e: any) → void
| arg | type | description |
|---|---|---|
| m | any | |
| ctx | any | |
| e | any |
col(q: any) → void
| arg | type | description |
|---|---|---|
| q | any |
buggy(k: any, look: any) → void
The buggy: a narrow open tub with a tube cage, seats and a rear engine.
| arg | type | description |
|---|---|---|
| k | any | |
| look | any |
extras(m: any, ctx: any, e: any) → void
| arg | type | description |
|---|---|---|
| m | any | |
| ctx | any | |
| e | any |
kart(k: any, look: any) → void
The kart is built from parts only (no loft).
| arg | type | description |
|---|---|---|
| k | any | |
| look | any |
extras(m: any, ctx: any, e: any) → void
| arg | type | description |
|---|---|---|
| m | any | |
| ctx | any | |
| e | any |
taper(a: number, b: number, c: number) → void
| arg | type | description |
|---|---|---|
| a | number | |
| b | number | |
| c | number |
col(q: any) → void
| arg | type | description |
|---|---|---|
| q | any |
body(kindName: string, lookName: string) → any
| arg | type | description |
|---|---|---|
| kindName | string | |
| lookName | string |
prof(_s: number) → void
| arg | type | description |
|---|---|---|
| _s | number |
deck(_s: number) → void
| arg | type | description |
|---|---|---|
| _s | number |
Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Showing up to 3 levels deep. Open a part to see what it holds further down.
Problems
Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.
agent_score is exposed.+ quality × 0.35
+ performance × 0.25
± compat factor
Usability ratings
Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".
Scoped to this part · feeds back into the world's score.