num(default: number, min: number, max: number, step: number, label: string) → any
shape: how the part is drawn and what its geometry means
"box" solid box (size = full extents)
"shellBox" hollow box, walls `thickness` mm
"wedge" hollow triangular prism along X: full height at +Z (back),
edge at -Z (front) on the bottom face
"dome" hollow half-ellipsoid, flat base at -Y
"cylY" hollow elliptic cylinder, axis Y
"tube" hollow rectangular tube along Z
"wheel" tyre + hub, axis X (size.x = width, size.y = size.z = diameter)
"tread" tank track loop along Z
"discX" disc in the YZ plane, axis X (size.x = thickness)
"drumX" toothed cylinder, axis X
"barY" bar or disc spinning about Y (size.x = length/diameter)
"plate" hinged plate (flipper, lifter, srimech), hinge at +Z end
"arm" swinging arm with head at -Z (hammer), pivot at +Z
"jaw" crusher beak from above, pivot at +Z
"forks" N tines along -Z
"spike" cone pointing -Z
sizeRule: "free"; "yz" keeps size.y == size.z (round things about X);
"xz" keeps size.x == size.z.
params: name -> { kind = "number"|"enum"|"bool"|"text", default, min, max, step, options, label }
paintRole: which colour of the bot palette it takes by default.
| arg | type | description |
|---|
| default | number | |
| min | number | |
| max | number | |
| step | number | |
| label | string | |
enum(default: string, options: { string }, label: string) → any
| arg | type | description |
|---|
| default | string | |
| options | { string } | |
| label | string | |
v3(t: any, default: V3) → V3
| arg | type | description |
|---|
| t | any | |
| default | V3 | |
quat(rot: V3) → void
Quaternion {x,y,z,w} of a part rotation {pitch, yaw, roll} in degrees (yaw about Y, then pitch about X, then roll about Z).
rotate(rot: V3, v: V3) → V3
Rotate vector v by a part rotation {pitch, yaw, roll} (degrees).
| arg | type | description |
|---|
| rot | V3 | |
| v | V3 | |
rotateQ(q: { number }, v: V3) → V3
Rotate vector v by a quaternion {x,y,z,w} (as M.quat returns). Use it to rotate many vectors by one part rotation.
| arg | type | description |
|---|
| q | { number } | |
| v | V3 | |
toBot(part: any, local_: V3) → V3
A point in the part's local frame (metres from its centre) as a bot-space point.
| arg | type | description |
|---|
| part | any | |
| local_ | V3 | |
axes(part: any) → void
The part's local axes in bot space: right (+X), up (+Y), forward (-Z, its working face).
| arg | type | description |
|---|
| part | any | |
corners(part: any) → void
The 8 corners of the part's box in bot space.
| arg | type | description |
|---|
| part | any | |
aabb(part: any) → void
Bot-space axis-aligned bounds of a part: (min, max).
| arg | type | description |
|---|
| part | any | |
distanceTo(part: any, point: V3) → number
Distance from a bot-space point to the part's (oriented) box; 0 inside.
| arg | type | description |
|---|
| part | any | |
| point | V3 | |
comp(axis: V3, half: number) → number
| arg | type | description |
|---|
| axis | V3 | |
| half | number | |
clampSize(def: any, s: V3) → V3
| arg | type | description |
|---|
| def | any | |
| s | V3 | |
normParam(spec: any, v: any) → any
| arg | type | description |
|---|
| spec | any | |
| v | any | |
normalize(p: any) → any
Repair one part table: known type, finite in-range size/params, a material it can take, a clean paint override. Returns nil for an unknown type.
new(typeName: string, fields: any?) → any
A new part of `type` with catalogue defaults, overridden by `fields` (pos, rot, size, material, params, paint). Has no id until a design or session gives it one.
| arg | type | description |
|---|
| typeName | string | |
| fields | any? | |
mirrored(p: any) → any
A copy of a part reflected across the bot's centre line (x = 0): x negated, yaw and roll negated. Keeps no id or mirror link.
onCentreLine(p: any) → boolean
True if a part sits on the centre line (its mirror would land on itself).
ellipsePerimeter(a: number, b: number) → number
| arg | type | description |
|---|
| a | number | |
| b | number | |
halfEllipsoidArea(a: number, b: number, c: number) → number
| arg | type | description |
|---|
| a | number | |
| b | number | |
| c | number | |
area(p: any) → number
Surface area (m^2) of a shell/plate part's skin, the part's armour area.
metrics(p: any) → any
Physical numbers of one part: massKg, lb, hp (hit points before it breaks off), armorScale (health damage multiplier when this part takes a hit), thickness (mm, for armour), area (m^2).
plateArmour(tmm: number) → void
| arg | type | description |
|---|
| tmm | number | |
softness(p: any) → any
SoftBody parameters for an armour part's material and thickness (stiffness, plasticYield, plasticMax, tearStrain, dentPerDamage in metres per damage point).