5 minutes
Walls That Lay Themselves Out
A slab with no edges is a floor, not a table. It needs five walls — a back wall, two long sides, and the two angled rails that funnel a dying ball into the drain — and every one of them has an obvious position you could type. The left wall goes at x = -8. The back wall goes at z = -16.6. Type those and the table looks right, once. Then last lesson's pinballTable.resized fires with a width of 24, and all five numbers are lies.
The fix is not to compute the walls somewhere central. It is to let each wall carry the rule that produced its position, instead of the answer.
A position expressed as a fraction of the table
PinballLayout came down with PinballTable last lesson. Here is what it takes:
Read the coefficients as intent. xCoeff: -0.5 does not mean "minus eight"; it means the left edge. 0.5 means the right edge, -0.5 on Z means the back, and 0 means the centreline. The offsets are for things that sit a fixed distance from an edge rather than a fixed fraction of the table — the bottom rails use zCoeff: 0.5, zOffset: -3.05, which reads as "the drain end, three units back up the table".
Continue reading
Unlock the Full Course
Every lesson, the runnable examples, and the finished build — yours to keep.