logo

Babylon.js Market

By Lawrence

5 minutes

TL;DR — Add a Velocity6DOF and the Movement6DOFSystem integrator. Now the ship's position and orientation move a little every frame. It coasts and slowly rolls on its own instead of jumping between poses. New here: the velocity component and the quaternion integrator that moves the pose. The ship needs both before next lesson's flight law has any velocity to write into.

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-2/scene.json:

bjs download scene WingmanFlight1-lesson-2 --all

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

Last lesson you learned to aim the nose. Edit Player.Transform6DOF.ry, reload, and the falcon swings to a new heading. Its nose tracks the pose. But watch what it does between headings. It does nothing. Set ry, reload, and the ship snaps to that orientation and hangs there, stuck at the origin. Changing the pose teleports the ship. It never travels to the new pose. It just is there on the next reload. A fighter that only teleports isn't flying.

Flying needs two things the scene doesn't have yet. It needs a velocity. And it needs something that adds that velocity to the pose every frame.

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