logo
By Lawrence

5 minutes

Aim the Nose

The falcon from the last lesson is lit and framed, but frozen, staring off in one fixed direction. Before it can fly, its heading has to become a number you can change. And there is a second problem: 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 in the pose, one in the render sync.

One field goes into the JSON this lesson, and it is a measuring instrument rather than a feature. Add debugForward to the player's Renderable:

"Renderable": {
  "shape": "spaceplane",
  "sx": 3, "sy": 1, "sz": 4,
  "r": 0.55, "g": 0.62, "b": 0.78,
  "emissive": 0.18,
  "selfShadow": true,
  "glbSrc": "/spaceshooter/falconship.glb",
  "debugForward": true
}

Reload and a magenta rod runs out of the falcon's nose. That rod is not drawn from the art. It is drawn from the ship's pose — the entity's local +Z, without the per-asset correction this lesson is about. So the rod says where the game thinks forward is, the hull says where the artist thought forward was, and when the two line up the correction is right. Keep it on until lesson 9; you will use it three more times before then.

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