modelgen.module
README.md
modelgen
Builds every vehiclesKit vehicle model (9 kinds x 3 looks) as vertex-coloured triangle soup on torqueCars' meshkit, in the chassis frame (metres, x right, y up, y = 0 ground / waterline, front at -Z). Pure Luau and deterministic, no engine calls: vehiclesKit.modelbake calls it to write the mesh assets; nothing needs it at runtime.
Gen.body(kind, look) -> geometry(positions, normals, colors, uvs, indices, normalised to the unit box) withcenter,size,tris.Gen.parts(kind, look) -> { { name, spin, geom, center = pivot, size, tris } }: each part's geometry sits in a unit box centred on its pivot.Gen.layout(kind): seats, eye, hood, hull box, wheels and per-kind extras, the source of truthmodelbakecopies intomodelData.Gen.LOOKS: per-look resolution and style (lowpolyflat-shaded facets,toypuffed rounder sections with gloss accents,realdense smooth surfaces with panel lines, trim and lamps).- Building blocks other generators can reuse:
loft(superellipse sections swept along z, open arcs for hulls, angle-aligned colour bands,HOLEfor real openings),extrude/slabX/slabY(bevelled convex prisms),rev/solid/torus(revolved parts),wing/blade(aerofoil slabs),sweep(tube around a loop),belt(track loop),seat,plate,finish(b, pivot?).
Colours follow torqueCars meshkit.C: the alpha is the carBody part code (1 paint, .85 glass, .7 metal, .55 gloss, .4 trim/rubber, .25 lamp/glow, .1 tail lamp), so paints from torqueCars.bodies recolour only painted panels. Glass is opaque from outside and open from inside (the shader discards its back faces), which is why the bus passenger windows are cut as real openings: the seats inside show.