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 Arrive

- **Node Name:** `AI Arrive`

Overview

  • Node Name: AI Arrive
  • Category: once_f_duration
  • File: extensions/flowgraph/nodes/vehicle/ai/arrive.lua

Drives a vehicle toward a target waypoint using AI manual mode. The node monitors distance and velocity to determine arrival, then optionally disables the AI. Has a duration state that transitions from inactive → started → finished.

Pin Schema

Input Pins

PinTypeDefaultDescription
aiVehIdnumber-Vehicle ID to drive (uses player vehicle if empty)
waypointNamestring-Name of the target waypoint
checkDistancenumber1Arrival distance threshold; 0 = use waypoint radius (hidden)
checkVelocitynumber0.1Vehicle must be slower than this to count as arrived (hidden, hardcoded)

Output Pins

PinTypeDescription
distancenumberCurrent distance to the waypoint center (hidden)

Internals

Key Methods

MethodDescription
init()Sets initial state, enables autoDisableOnArrive
onNodeReset()Resets command sent flag and duration state
_executionStopped()Calls onNodeReset()
getVeh()Resolves vehicle by ID or player vehicle
work()Sends AI command (once), monitors distance/velocity for arrival

Arrival Detection

  1. Gets the vehicle's front position via corner positions interpolation.
  2. Computes distance to the waypoint node position.
  3. Vehicle is "arrived" when:
    • Distance < checkDistance (or waypoint radius if 0)
    • Velocity < checkVelocity (from map.objects[vehID].vel)
  4. On arrival, sets duration state to finished and optionally disables AI.

AI Command

The command is sent only once (self.sentCommand flag):

ai.setState({mode = "manual"})
ai.setTarget("waypointName")

How It Works

  1. First frame: sends ai.setState({mode = "manual"}) and ai.setTarget() to the vehicle.
  2. Each subsequent frame: measures distance from vehicle front to waypoint.
  3. When close enough and slow enough, transitions to finished.
  4. If autoDisableOnArrive is true (default), disables AI on arrival.
  5. Once finished, the node stops processing (early return).

Usage Example

-- Drive AI to a specific waypoint:
-- aiVehId = vehicleId
-- waypointName = "wp_finish_line"
-- checkDistance = 2 (meters)
-- checkVelocity = 0.5 (m/s, nearly stopped)

-- Chain with duration state:
-- Connect to nodes that react to 'finished' duration state
-- The node's flow output continues after arrival

Key Dependencies

  • map.getMap().nodes - waypoint node data (position, radius)
  • map.objects - vehicle tracking data (velocity)
  • ai.setState() / ai.setTarget() - vehicle AI commands

See Also

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

AI Parameters

- **Node Name:** `AI Parameters`

AI Chase

- **Node Name:** `AI Chase`

On this page

OverviewPin SchemaInput PinsOutput PinsInternalsKey MethodsArrival DetectionAI CommandHow It WorksUsage ExampleKey DependenciesSee Also