logo
By Lawrence

5 minutes

Thrust and Turn

The integrator will move anything you give a velocity to. Nothing gives the falcon one. You typed vz: 40 by hand last lesson and then deleted it, which is not a control system — it's a save-file edit with extra steps.

What's missing is the law in between: something that takes a wish — nose up, roll left, throttle open — and turns it into the six numbers the integrator already knows how to spend.

Add FlightIntent and ShipFlight to the player

Open src/scenes/spaceshooter.json and add both components to Player, next to the pose and velocity it already has:

"FlightIntent": {},
"ShipFlight": {
  "maxThrust": 35,
  "boostMultiplier": 1.5,
  "turnRate": 2.0,
  "rollRate": 3.0,
  "linearDrag": 1.8,
  "angularDrag": 7.0
},

Two components, and the split between them is the design. FlightIntent is what the pilot wants; ShipFlight is how this hull answers. Keep them apart and one set of controls can fly a nimble interceptor and a laden freighter, without a line of either knowing about the other.

Those six numbers are a deliberately poor first guess — a heavy, over-damped hull that turns like it is full of cargo. They are not the numbers this game ships. Flying them is the point: you cannot judge a flight law you have only ever felt at its final settings, and lesson 9 tunes each one against a specific complaint you will have formed by then. For now, wrong-but-flyable beats right-and-unexamined.

Continue reading

Unlock the Full Course

Every lesson, the runnable examples, and the finished build — yours to keep.

$9one-time

Was this page helpful?

We read every note — tell us what's working and what isn't.

↑↓ NavigateEnter SelectEsc CloseCtrl+K Open Search