RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Flowgraph Base ModuleFlowgraph Base NodeFlowgraph Base State NodeFlowgraph Node BuilderFlowgraph GraphFlowgraph Group HelperFlowgraph LinkFlowgraph ManagerNew Node TemplateFlowgraph PinFlowgraph States ManagerFlowgraph UtilsFlowgraph Variable Storage
Align For CouplingApply Velocity to VehicleBoost VehicleSet Vehicle ColorsCustom Parts Config ProviderEnter VehicleFlip UprightFreeze VehicleGenerate License PlateGet Vehicle ActiveGet Electrics ValueGet GearboxmodeGet Powertrain DataGravity ForceDistance From GroundHas Coupler TagIs CoupledIs Player UsableKeep VehicleMove Vehicle ToOn Cannon FiredOn Vehicle DestroyedOn Vehicle ResetOn Vehicle SpawnedOn Vehicle SwitchedPlayer UsableRandom Config ProviderRecover In PlaceRemove VehicleTimeline ReplaySet Vehicle ActiveSet Gearbox ModeSet IgnitionSet License PlateSet LightbarSet LightsShift to Gear IndexSpawn VehicleVehicle StatesTeleport To Last RoadToggle Vehicle ControlsMove To ShowroomVehicle TouchProps TouchStatic Object TouchTrack VehicleTrailer Respawn ControlVehicle Config ProviderGet Vehicle DataGet Vehicle DataGet Vehicle BoundsVehicle PingGet Vehicle Wheel Center
AI ParametersAI ArriveAI ChaseAI Directly ToAI DisableAI FleeAI FollowAI Follow WaypointsGet AI ModeAI Go To The End LineAI RandomFollow DecalroadAI StopAI Traffic

UI

Resources

BeamNG Game Engine Lua Cheat SheetGE Developer RecipesMCP Server Setup

// RLS.STUDIOS=true

Premium Mods for BeamNG.drive. Career systems, custom vehicles, and immersive gameplay experiences.

Index

HomeProjectsPatreon

Socials

DiscordPatreon (RLS)Patreon (Vehicles)

© 2026 RLS Studios. All rights reserved.

Modding since 2024

API ReferenceGE Extensionsflowgraphnodesvehicleai

AI Go To The End Line

- **Node Name:** `AI Go To The End Line`

Overview

  • Node Name: AI Go To The End Line
  • Category: once_f_duration (behaviour: duration)
  • File: extensions/flowgraph/nodes/vehicle/ai/goToEndLine.lua

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.

Pin Schema

Input Pins

PinTypeDefaultDescription
flowflow-Inflow for this node.
resetflow (impulse)-Resets the node so the destination can be driven to again.
aiVehIdnumber-The AI vehicle. Uses player vehicle if empty.
endLinePositionvec3-Position of the end line to drive to.
checkDistancenumber1Distance threshold to consider arrived (hidden).
checkVelocitynumber0.1Vehicle must be slower than this to be considered arrived (hidden, hardcoded).

Output Pins

PinTypeDescription
flowflowFires once the destination is reached and the vehicle is slow enough.
distancenumberCurrent distance to the target waypoint center (hidden).

Internals

Key Methods

MethodDescription
work()Main loop - checks distance from vehicle front to target, sets AI manual mode once, marks complete when close + slow.
onNodeReset()Clears complete and sentCommand flags.
_executionStopped()Calls onNodeReset().
getVeh()Resolves vehicle from aiVehId pin or falls back to player vehicle.

Data Properties

PropertyDefaultDescription
autoDisableOnArrivetrueAutomatically disables AI when the vehicle arrives.

How It Works

  1. On first work() with flow, sends ai.setState({mode = "manual"}) to the vehicle (once).
  2. Each frame, calculates distance from the vehicle's front center point to the target endLinePosition.
  3. When distance drops below checkDistance, checks if velocity is below checkVelocity.
  4. Once both conditions are met, sets complete = true and optionally disables AI.
  5. 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()

Usage Example

-- 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.

Key Dependencies

  • ai.setState({mode = "manual"}) - sets AI to manual driving mode
  • ai.setState({mode = "disabled"}) - disables AI on arrival
  • map.objects[id].vel - velocity lookup from the map module
  • linePointFromXnorm() - linear interpolation between two points

Previously Undocumented (Added by Audit)

  • Input Pin: inRadius (any)

See Also

  • AI Parameters (Flowgraph Node) - Related reference
  • AI Arrive (Flowgraph Node) - Related reference
  • AI Chase (Flowgraph Node) - Related reference
  • FlowGraph Guide - Guide

Get AI Mode

- **Node Name:** `Get AI Mode`

AI Random

- **Node Name:** `AI Random`

On this page

OverviewPin SchemaInput PinsOutput PinsInternalsKey MethodsData PropertiesHow It WorksUsage ExampleKey DependenciesPreviously Undocumented (Added by Audit)See Also