Skip to content

five-on-it / packages/ai/src/traffic-route / projectAhead

Function: projectAhead() ​

projectAhead(route, from, reach, x, z): { along: number; dirX: number; dirZ: number; off: number; } | undefined

Defined in: packages/ai/src/traffic-route.ts:315

Where an object stands relative to the route ahead of from (m along), up to reach metres on: how far along the route its projection lies, how far off the route, and the route's heading there; undefined when it projects onto nothing of that stretch ahead.

Parameters ​

route ​

TrafficRoute

from ​

number

reach ​

number

x ​

number

z ​

number

Returns ​

{ along: number; dirX: number; dirZ: number; off: number; } | undefined