Drives a vehicle to a target end-line position using the AI in manual mode. Outputs flow once the vehicle reaches the position and slows below a threshold velocity.
On first work() with flow, sends ai.setState({mode = "manual"}) to the vehicle (once).
Each frame, calculates distance from the vehicle's front center point to the target endLinePosition.
When distance drops below checkDistance, checks if velocity is below checkVelocity.
Once both conditions are met, sets complete = true and optionally disables AI.
Outputs flow on the next frame after completion.
-- The front position is calculated as the midpoint of the two front corners:local frontPos = linePointFromXnorm( vec3(veh:getCornerPosition(0)), vec3(veh:getCornerPosition(1)), 0.5)local dist = (frontPos - endLinePosition):length()
-- In a flowgraph:-- [Set Position] → endLinePosition → [AI Go To End Line] → flow → [Next Step]-- ↑ aiVehId from vehicle spawn-- Useful for race finish lines, parking challenges, delivery endpoints.