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
Route Distance (Flowgraph Node)Closest Road (Flowgraph Node)Custom Lua (Flowgraph Node)Distance Between (Flowgraph Node)Waypoints Distance (Flowgraph Node)File Exists (Flowgraph Node)Get First Element of Table (Flowgraph Node)Get Level Data (Flowgraph Node)Get Map Objects IDs by DynField (Flowgraph Node)Get Table Value By Key (Flowgraph Node)GHOST (Flowgraph Node)Hide Loading Screen (Flowgraph Node)Color HSV (Flowgraph Node)Line Point From Xnorm (Flowgraph Node)Load Level (Flowgraph Node)Load Project (Flowgraph Node)On Menu (Flowgraph Node)Perlin Noise (Flowgraph Node)Pop Action Map (Flowgraph Node)Get Project InfoPush Action MapRandom ColorRandom NumberRandom QuaternionRandom VectorRoad PropertiesGet Navgraph RouteRoute PositionTemplate NodeTimeTimed SequenceTo NumberTo StringWorld Editor Open

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 Extensionsflowgraphnodesutil

Route Distance (Flowgraph Node)

- **Node Name:** `Route Distance`

Overview

  • Node Name: Route Distance
  • Category: repeat_instant
  • File: extensions/flowgraph/nodes/util/closestPath.lua

Finds the approximate remaining distance along a navgraph route from a tracked position. Supports both two-point and multi-waypoint routes.

Pin Schema

Input Pins

PinTypeDescription
setRouteflow (impulse)Sets/recalculates the route
trackedPosvec3The position being tracked along the route
posAvec3First endpoint (shown when waypoints mode is off)
posBvec3Second endpoint (shown when waypoints mode is off)
waypointstableOrdered waypoint positions (shown when waypoints mode is on)

Output Pins

PinTypeDescription
distnumberDistance remaining to the end of the route (-1 if invalid)

Internals

Key Methods

MethodDescription
init()Initializes the waypoint toggle
work()Sets route on impulse, tracks position, outputs distance
drawCustomProperties()ImGui checkbox to toggle waypoints mode
updatePins()Swaps between posA/posB pins and waypoints pin

Editor Properties

PropertyTypeDescription
waypointboolToggle between two-point and multi-waypoint mode

How It Works

  1. When setRoute is triggered, creates a new gameplay/route/route instance.
  2. In two-point mode, calls route:setupPathMulti({posB, posA}) (note reversed order).
  3. In waypoints mode, calls route:setupPathMulti(waypoints).
  4. On each frame, if trackedPos has changed, calls route:trackPosition(trackedPos).
  5. Outputs route.path[1].distToTarget as the remaining distance.

Usage Example

-- Create a route and track distance:
local route = require('/lua/ge/extensions/gameplay/route/route')()
route:setupPathMulti({vec3(startPos), vec3(endPos)})

-- Each frame:
route:trackPosition(vec3(currentPos))
local remaining = route.path[1].distToTarget

-- In flowgraph:
-- [Set Route impulse] → [Route Distance] → dist → [Compare/Display]
--    ↑ posA, posB              ↑ trackedPos (from vehicle)

Key Dependencies

  • gameplay/route/route - route calculation along navgraph
  • route:setupPathMulti() - multi-waypoint route setup
  • route:trackPosition() - updates position along route

See Also

  • Closest Road (Flowgraph Node) - Related reference
  • Custom Lua (Flowgraph Node) - Related reference
  • Distance Between (Flowgraph Node) - Related reference
  • FlowGraph Guide - Guide

StartScreen Text Panel (Flowgraph Node)

- **Node Name:** `StartScreen Text Panel`

Closest Road (Flowgraph Node)

- **Node Name:** `Closest Road`

On this page

OverviewPin SchemaInput PinsOutput PinsInternalsKey MethodsEditor PropertiesHow It WorksUsage ExampleKey DependenciesSee Also