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

Get Navgraph Route

- **Node Name:** `Get Navgraph Route`

Overview

  • Node Name: Get Navgraph Route
  • Category: once_instant
  • File: extensions/flowgraph/nodes/util/routePointToPoint.lua

Finds a navgraph route between two world positions. Snaps each position to the closest navgraph node, then computes a path using the map pathfinder.

Pin Schema

Input Pins

PinTypeDefaultDescription
posAvec3-Start position
posBvec3-Finish position
legalRoutebooltrueIf true, respect legal road directions (hidden)

Output Pins

PinTypeDescription
navgraphRoutetable (navgraphPath)Array of waypoint names forming the route

Internals

Key Methods

MethodDescription
workOnce()Finds closest navgraph nodes to each position and computes a path

Route Calculation

  1. For each position (posA, posB), calls map.findClosestRoad() to get the two nearest nodes.
  2. Selects the closer of the two nodes by squared distance comparison.
  3. Calls map.getPath(nodeA, nodeB, nil, penalty) where penalty is 1000 for legal routes or 1 for unrestricted.

Legal vs Unrestricted Routes

  • Legal route (legalRoute = true): Uses a high penalty (1000) for wrong-way traversal, effectively forcing legal directions.
  • Unrestricted (legalRoute = false): Uses penalty of 1 so wrong-way roads are treated the same as normal.

How It Works

  1. Converts posA and posB from tables to vec3.
  2. Finds the nearest navgraph road nodes for both positions.
  3. Picks the closer node of the two candidates at each end.
  4. Runs the map pathfinder between the two nodes.
  5. Outputs the resulting waypoint array, suitable for AI driving or route display.

Usage Example

-- Find a legal route between two positions:
-- posA = {100, 200, 30}  -- start world position
-- posB = {500, 800, 35}  -- finish world position
-- legalRoute = true
-- Output: {"wp_001", "wp_002", "wp_003", ...}

-- Use with AI Follow Waypoints node:
-- Connect navgraphRoute output → AI Follow Waypoints navgraphPath input

Key Dependencies

  • map.findClosestRoad() - finds nearest navgraph road from a position
  • map.getPath() - navgraph A* pathfinder
  • map.getMap().nodes - navgraph node data

See Also

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

Road Properties

- **Node Name:** `Road Properties`

Route Position

- **Node Name:** `Route Position`

On this page

OverviewPin SchemaInput PinsOutput PinsInternalsKey MethodsRoute CalculationLegal vs Unrestricted RoutesHow It WorksUsage ExampleKey DependenciesSee Also