logo

Babylon.js Market

By Lawrence

5 minutes

TL;DR — This lesson adds the flight-control law. FlightIntent (a normalised stick-and-throttle) and ShipFlight (the hull's tuning) feed FlightControlSystem. That system turns them into thrust down the nose, a body-frame turn, and drag, all written onto Velocity6DOF. New here: the law that turns pilot intent into velocity. The ship needs it before next lesson's keyboard can take the stick.

Catching up?

Dropping in at this lesson? One command reinstalls the library components the build uses so far and writes the scene as it stood at the end of the previous lesson to public/scenes/WingmanFlight1-lesson-4/scene.json:

bjs download scene WingmanFlight1-lesson-4 --all

Copy that scene.json over your src/scenes/wingman.json and you are caught up to the start of this lesson.

Last lesson the falcon only drifted. We typed a velocity into the save file by hand, then deleted it. Velocity6DOF is real, and the integrator runs every frame. But nothing sets that velocity. A fighter that moves only when you edit a JSON file isn't really a fighter. It needs a control law. That law reads a stick-and-throttle and writes the velocity for you.

The law splits into two parts. One part is what the pilot wants, like push forward or roll left. The other part is how one ship answers that wish. A quick little interceptor answers differently from a heavy freighter. Wingman keeps these two parts in separate components, FlightIntent and ShipFlight. That way one set of controls can fly any ship.

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