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

Follow Decalroad

- **Node Name:** `Follow Decalroad`

Overview

  • Node Name: Follow Decalroad
  • File: extensions/flowgraph/nodes/vehicle/ai/simpleFollowDecalroad.lua
  • Behaviour: duration

Converts a DecalRoad object into a ScriptAI path and drives a vehicle along it. Provides progress tracking and start/stop control.

Pin Schema

Input Pins

PinTypeDescription
flowflowInflow for this node.
startflowStarts the AI when flow is received.
stopflowStops the AI when flow is received.
roadNamestringName of the DecalRoad object in the scene tree.
vehIdnumberVehicle ID. Uses player vehicle if empty.
loopCountnumberNumber of loops (-1 = infinite, hidden).

Output Pins

PinTypeDescription
flowflowGeneral outflow.
activeflowOutputs flow while the AI is actively following.
finishedflowOutputs flow when the AI finishes the path.
progressnumberRelative progress from 0 to 1.

Internals

Key Methods

MethodDescription
init()Sets defaults: speed=5, loopMode="startReset".
loadRecording()Reads DecalRoad node positions, computes distances, generates path with timing based on data.speed.
play()Loads path and starts ai.startFollowing().
stop()Sends ai.stopFollowing() and clears active state.
onVehicleSubmitInfo(id, info)Receives progress updates - scriptTime / endScriptTime for progress, nil info = finished.
work()Dispatches start/stop impulses.

Data Properties

PropertyDefaultDescription
speed5Speed (m/s) used to calculate waypoint timestamps.
loopMode"startReset"Loop reset mode for the ScriptAI.
renderDebugfalseDraw path debug visualization.

How It Works

  1. loadRecording() iterates over the DecalRoad's nodes via road:getNodeCount() and road:getNodePosition(i).
  2. Accumulates segment distances to compute timing: t = distance / speed.
  3. Sets the first waypoint's dir (direction to second point) and up (hardcoded Z-up).
  4. play() sends the path to ai.startFollowing() with loop settings.
  5. Progress is tracked via onVehicleSubmitInfo callback - scriptTime / endScriptTime.
-- Path generation from DecalRoad:
local road = scenetree.findObject("myRoad")
local path = {}
local dist = 0
for i = 0, road:getNodeCount() - 2 do
  local pos = vec3(road:getNodePosition(i))
  table.insert(path, {x=pos.x, y=pos.y, z=pos.z, t=dist/speed})
  dist = dist + (vec3(road:getNodePosition(i+1)) - pos):length()
end

Usage Example

-- Flowgraph:
-- [Start Button] → start → [Follow Decalroad (roadName="race_track", speed=10)]
--                                → progress → [Progress Bar]
--                                → finished → [Race Complete]

Key Dependencies

  • scenetree.findObject() - resolves the DecalRoad by name
  • road:getNodeCount() / road:getNodePosition() - reads road geometry
  • ai.startFollowing() / ai.stopFollowing() - vehicle-side ScriptAI
  • onVehicleSubmitInfo hook - progress tracking from vehicle VM

See Also

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

AI Random

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

AI Stop

- **Node Name:** `AI Stop`

On this page

OverviewPin SchemaInput PinsOutput PinsInternalsKey MethodsData PropertiesHow It WorksUsage ExampleKey DependenciesSee Also