Log inGet started
Package

Construction.module

Newest version

README.md

Construction

Hand-built geometry and the builders behind it, for the excavator sim in scenes/main.scene.

Nothing stock reads as an excavator, so the machine is authored: a bucket is an open curved shell, a track is a swept loop with grousers, a dirt heap is a lumpy dome. Each function returns the flat-array geometry asset.create("mesh", name, geom) takes, so a scene build turns them into durable mesh assets.

What it provides

CallWhat you get
builder()A mesh accumulator: tri, faceNormal, build.
boxInto(b, centre, half, [rx])A box, optionally turned about the X axis.
beamInto(b, stations)A tapered rectangular beam swept through {z, y, hw, hh} stations.
loopInto(b, path, hw, thickness)A band swept round a closed Z/Y path.
track(opts)A whole track — belt loop plus tread plates — standing on y = 0.
bucket(opts)The bucket shell and teeth. Pivot at the top of the back plate, opening toward +Z.
mound(opts)A lumpy closed dirt heap, deterministic from seed.

The convention that keeps winding correct

Every quad goes in through faceNormal(a, b, c, d, want), stating the direction it should face. The builder works out which way the corners as given actually run and reverses them when they disagree, then emits both triangles with want as the flat face normal. Winding a hand-built mesh backwards is the classic bug that makes a solid render inside-out; this makes it unreachable. Normals are per-face, which is what plate and box look like under light.

Callers

scenes/main.scene/build.luau — it makes the machine and the site from these. Read the module before adding a part, so a new shape goes in as another sweep or box rather than as a one-off vertex list.