Skip to content

five-on-it / packages/ai/src/traffic / spawnTrafficCar

Function: spawnTrafficCar() ​

spawnTrafficCar(ai, edge, k, cls?): TrafficCar

Defined in: packages/ai/src/traffic.ts:679

Puts an ambient car of class cls on lane edge, k of the way along it (0 to 1), facing along the lane, its driver at the wheel and a cruising share drawn; it joins the traffic in car order and drives from the next tick. The traffic's own spawns come through here; so can a test's or a mission's.

Parameters ​

ai ​

AiWorld

edge ​

number

k ​

number

cls? ​

number = 0

Returns ​

TrafficCar