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

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 Extensionsflowgraphnodesvehicle

Distance From Ground

- **Node Name:** `Distance From Ground`

Overview

  • Node Name: Distance From Ground
  • Category: repeat_instant
  • File: extensions/flowgraph/nodes/vehicle/groundDistance.lua

Reports the distance of the lowest point of a vehicle's bounding box from the terrain below. Uses raycasts from each of the 8 OBB corners to find the minimum clearance.

Pin Schema

Input Pins

PinTypeDefaultDescription
vehIdnumber-ID of the vehicle to measure
zOffsetnumber10(hidden, hardcoded) Height offset for raycast origin. Increase if getting infinite values when close to terrain

Output Pins

PinTypeDescription
lowestDistancenumberDistance of the lowest bounding box point from the terrain below

Internals

Key Methods

MethodDescription
init()Initializes drawDebug data flag (default false)
work()Iterates over all 8 OBB corners, raycasts downward from each, finds the minimum distance

Debug Drawing

When self.data.drawDebug is true, the node draws text labels at each OBB point showing the distance to the ground.

How It Works

  1. Gets the vehicle's spawn world-oriented bounding box (OBB) via veh:getSpawnWorldOOBB().
  2. For each of the 8 corner points:
    • Creates an offset point raised by zOffset units on the Z axis.
    • Calls be:getSurfaceHeightBelow(offset) to get the terrain height directly below.
    • Computes point.z - hit as the distance from that corner to the ground.
    • Tracks the minimum distance across all 8 points.
  3. Outputs the lowest distance. A value of math.huge means no terrain was found below.

Usage Example

-- In a flowgraph:
-- [Distance From Ground] ← vehId ← [Vehicle ID]
--   → lowestDistance → [Compare < 0.1] → [Vehicle is grounded]

-- Programmatic equivalent:
local veh = scenetree.findObjectById(vehId)
local oobb = veh:getSpawnWorldOOBB()
local lowest = math.huge
for i = 0, 7 do
  local point = oobb:getPoint(i)
  local offset = vec3(point)
  offset.z = offset.z + 10
  local hit = be:getSurfaceHeightBelow(offset)
  if hit then
    lowest = math.min(lowest, point.z - hit)
  end
end

Key Dependencies

  • veh:getSpawnWorldOOBB() - returns the vehicle's oriented bounding box in world space
  • be:getSurfaceHeightBelow() - raycasts downward to find terrain surface height

See Also

  • Align for Coupling (Flowgraph Node) - Related reference
  • Apply Velocity to Vehicle (Flowgraph Node) - Related reference
  • Boost Vehicle (Flowgraph Node) - Related reference
  • FlowGraph Guide - Guide

Gravity Force

- **Node Name:** `Gravity Force`

Has Coupler Tag

- **Node Name:** `Has Coupler Tag`

On this page

OverviewPin SchemaInput PinsOutput PinsInternalsKey MethodsDebug DrawingHow It WorksUsage ExampleKey DependenciesSee Also