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
Get Custom Vehicle ValueCustom vlua - deprecatedCustom Vehicle LuaVehicle ActionWheel Distance

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 Extensionsflowgraphnodesvehiclespecial

Wheel Distance

- **Node Name:** `Wheel Distance`

Overview

  • Node Name: Wheel Distance
  • Category: repeat_p_duration
  • File: extensions/flowgraph/nodes/vehicle/special/wheelDistance.lua

Calculates the distance from the closest wheel center(s) of a vehicle to a given world-space point. Useful for precise start/finish line detection in races.

Pin Schema

Input Pins

PinTypeDescription
vehIdnumberVehicle ID. Falls back to player vehicle if empty.
positionvec3World-space target position to measure distance to.

Output Pins

PinTypeDescription
distancenumberSigned distance from the closest wheel pair midpoint to the target, projected along the vehicle's forward axis.

Internals

Key Methods

MethodDescription
init()Sets data.debug = false and data.onlyUseFrontWheels = true.
calculateDistanceFromStart(vehicle, target)Core calculation - iterates all wheels, finds the two closest, and computes signed distance.
work()Resolves the vehicle, reads the position pin, and calls calculateDistanceFromStart.

Helper Functions

FunctionDescription
getTwoSmallestValues(values)Finds the two wheels with the smallest distance to the target. Returns a pair (or duplicates the single closest for odd wheel counts).

How It Works

  1. Iterates over all vehicle wheels using veh:getWheelCount() and veh:getWheelAxisNodes().
  2. Optionally filters to front wheels only (dot product of wheel-to-center vector with direction vector > 0).
  3. For each qualifying wheel, projects the wheel-to-target vector onto the vehicle's forward direction to get a scalar distance.
  4. Finds the two closest wheels and averages their positions.
  5. Computes the final signed distance from this midpoint to the target, projected along the forward axis.
  6. In debug mode, draws lines, spheres, and text labels using debugDrawer.

Usage Example

-- Flowgraph:
-- [Vehicle Provider] → vehId → [Wheel Distance] ← position ← [Start Line Pos]
--                                    ↓
--                               distance → [Compare: < 0.5] → [Race Started!]

-- The signed distance is negative when the vehicle has passed the target point.
-- This allows precise start/finish line crossing detection.

Key Dependencies

  • veh:getWheelCount() / veh:getWheelAxisNodes() - wheel node access
  • veh:getNodePosition() - beam node world positions
  • veh:getSpawnWorldOOBB() - oriented bounding box for center calculation
  • debugDrawer - optional visual debug output

See Also

  • Get Custom Vehicle Value (Flowgraph Node) - Related reference
  • Custom Vehicle Lua (Flowgraph Node) - Related reference
  • Custom vlua - Deprecated (Flowgraph Node) - Related reference
  • FlowGraph Guide - Guide

Vehicle Action

- **Node Name:** `Vehicle Action`

Freeroam Big Map Markers

Manages clustering and rendering of POI markers on the big map. Handles quadtree-based spatial clustering, marker lifecycle, mouse hover detection, and visibility filtering.

On this page

OverviewPin SchemaInput PinsOutput PinsInternalsKey MethodsHelper FunctionsHow It WorksUsage ExampleKey DependenciesSee Also