logo
By Lawrence

5 minutes

Appendix: Escort the Convoy

This lesson is off the main build. The shipped SpaceshooterFlight scene contains no gates and no convoy, and Lesson 14 checked your file against it exactly. Nothing here belongs in that file, and there is no catch-up checkpoint for it.

What it is instead is the other mission the pieces you already own can run. Twice in this course you built gear that has sat idle: the wave director bucketed four fighters behind waypoint gate 2 and nothing ever opened it, and the mission director signed up for two win events that no scene could fire. Both come alive here, with no code change at all.

Work on a copy of your scene. Everything below is additive.

A route through the field

A gate is a ring you fly through, and its component is six numbers:

src/components/Waypoint/Waypoint.defs.ts
export interface WaypointInput {
  index?: number;
  radius?: number;
  fx?: number;
  fy?: number;
  fz?: number;
  /** True once the player has flown through this gate. */
  reached?: boolean;
  /** True once the player has crossed past without flying through. */
  missed?: boolean;
}

index is the gate's place in the running order, not its place in the file. radius is the trigger sphere. fx/fy/fz point from this gate toward the next one, which is what lets the system tell "hasn't got here yet" apart from "went past it".

Three gates and a track marker on the player:

    "Gate0": {
      "tags": ["waypoint"],
      "components": {
        "Transform6DOF": { "x": 40, "y": 10, "z": 240 },
        "Waypoint": { "index": 0, "radius": 90, "fx": -0.33, "fy": -0.08, "fz": 0.94 },
        "Renderable": {
          "shape": "waypoint", "sx": 60, "sy": 60, "sz": 10,
          "r": 0.18, "g": 0.42, "b": 0.85, "emissive": 0.5
        }
      }
    }

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