Skip to content

five-on-it / packages/ai/src/steer-vehicle / planRoute

Function: planRoute() ​

planRoute(ai, npc, x, z, hx, hz, goalX, goalZ): void

Defined in: packages/ai/src/steer-vehicle.ts:230

Plans the drive from (x, z) (heading hx, hz) to the goal when the current route is missing, due, or aimed too far from the goal, within the world's plans for this tick: a clear straight line within reach is driven as it is; with the car and the goal both near a road the roads are followed (roadWaypoints); else the car's grid is searched like a walk.

Parameters ​

ai ​

AiWorld

npc ​

NpcState

x ​

number

z ​

number

hx ​

number

hz ​

number

goalX ​

number

goalZ ​

number

Returns ​

void