logo

Babylon.js Market

By Lawrence

5 minutes

TL;DR — The ship's heading is a quaternion you can set. The render sync adds a per-model yaw, so the falcon's nose points where the pose aims at any pitch. New here: the orientation and the nose-facing fit. The ship needs both before velocity moves it in the next lesson.

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.

The falcon from the last lesson is lit and framed, but frozen. It stares off in one fixed direction. Before it can fly, its heading has to become a number you can change. There is a second problem too. A GLB's nose almost never points along the model's own local +Z. So even once you can aim the ship, the art can fly sideways. Both problems are already solved in the scene you built. One fix lives in the pose, and one lives in the render sync. This lesson opens them up on the ship you are looking at.

You add nothing new to the JSON this lesson. The player already carries the pose from Lesson 1. You will change one field in it, watch the falcon swing, then change it back.

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