Living Museum of Learning

Where real moments become exhibits
← Prev Next →
Build Everything at the Origin

Build Everything at the Origin

One goal net, one coordinate system, and one hour of growing as a programmer

Jayden continued working on his World Cup animation by adding a net to his soccer goal. Visually, the goal immediately looked much richer. But the real lesson wasn't about soccer—it was about how to organize code.

Jayden naturally wanted each new part to be drawn where it would finally appear. Every time he built a new component, he instinctively translated it into position first.

I kept repeating the same idea:

"Build every part at the origin—the most convenient place. Let the caller decide where it belongs."

When he wrote drawTopNet(), he wanted to lift it onto the goal immediately. I asked him not to.

"Leave it on the ground. drawGoal() will lift it."

Earlier in the class I had made a similar suggestion for the trapezoid frame:

"Raise the whole trapezoid by half its height. Trust me—our lives will become easier."

A few minutes later, Jayden noticed something himself.

Many of his mysterious /2 calculations had simply disappeared.

The coordinate system had become his friend instead of his enemy.

Another beautiful moment came when Jayden began drawing the net.

line() in P5JS takes six numbers:

line(x1, y1, z1,
x2, y2, z2)

Instead of explaining the syntax, I opened Desmos.

"No... not the 2D calculator."

We switched to the 3D version.

I said,

"Imagine putting a point in space by writing three numbers inside parentheses."

(1, 2, 3)

"Now put another point somewhere else."

(0, 0, 0)

"That's all line() needs—two points."

Jayden spent several minutes simply rotating the 3D scene, zooming in and out, looking at points floating in space.

When we returned to P5JS, drawing the net suddenly felt natural.

Even the slanted side bars no longer bothered him.

I told him,

"Pretend they're vertical. Treat the trapezoid as a rectangle."

Perfection could wait.

Progress couldn't.

By the end of the hour, the thin green box had become a soccer field.

One goal appeared.

Then another.

The first rotation buried the second goal underground.

Jayden quickly realized he had rotated around the wrong axis, fixed it himself, and suddenly the entire field looked gorgeous.

Young programmers often think about where an object belongs.

Experienced programmers think about how an object should be built.

Those are different questions.

When every component is created in its own simple local coordinate system, programs become shorter, cleaner, easier to reuse, and much easier to reason about.

The same idea appears everywhere—from game engines to CAD software to robotics.

"Build every part at the origin. Let the caller decide where it belongs."

That's much bigger than a soccer goal. It's a principle that scales all the way to professional software engineering.