Navigation · interface

NavSteer

Following a route, which is the half of navigation that is not the search.

Explained in Navigation.

interface NavSteer
import type { NavSteer } from '@driftengine/nav';

In depth

A path is a list of nodes and an agent is not. Between the two sits a set of decisions every consumer makes and none of them enjoys: when has a waypoint been reached, what happens when the agent is pushed off the line, what does the last waypoint mean, and — the one that is always got wrong first — what do you steer at. Steering at the next node makes an agent visibly zigzag between waypoints on a curved road; steering at a point a fixed distance ahead along the path makes it cut the corner smoothly, and that is what this returns.

It does not move anything. It answers where to aim, in world units, and the caller applies their own speed, acceleration, turn rate and physics — which is the same boundary CharacterController and groundMotor draw, and for the same reason: how a thing moves is the game's, where it should go is the engine's.

Nothing here allocates and nothing reads a clock.

Properties

NameTypeDescription
xnumberWhere to aim, in world units.
ynumber
znumber
remainingMnumberHow far along the path is left, following the line rather than as the crow flies.
arrivedbooleanTrue once the agent is within arriveM of the final node.