paths
The route geometry AI drivers drive by, computed once per path: `resample(points, loop, spacing)` (even spacing; sparse waypoints are joined with a Catmull-Rom spline), `normals` (right of travel), `curvatures` (signed 1/m, positive turning right, smoothed), `racingLine(points, l…
aiDrivers.paths
The route geometry AI drivers drive by, computed once per path: resample(points, loop, spacing) (even spacing; sparse waypoints are joined with a Catmull-Rom spline), normals (right of travel), curvatures (signed 1/m, positive turning right, smoothed), racingLine(points, loop, halfWidth) (each point slid sideways within the road to minimise curvature: outside on entry, apex clipped, outside on exit), offset (a lane), speedProfile(points, loop, curvature, { latG, maxSpeed, decel }) (cornering limit sqrt(latG*g/k) with braking points worked backwards from every corner), distances and nearest. Pure functions over {vector}; AiDriver calls them, and anything else that needs a racing line or a speed plan (a ghost car, a minimap line, a track editor) can too.
local Paths = require("aiDrivers.paths")
local pts = Paths.resample(waypoints, true, 2)
local line = Paths.racingLine(pts, true, 3.5)
local v = Paths.speedProfile(line, true, Paths.curvatures(line, true), { latG = 0.9, maxSpeed = 60, decel = 8 })
Scoped to this part · feeds back into the world's score.