RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

server/commands - Camera & Input Commandsge_utils - Game Engine Utility Functionsmain.lua - GE Lua Entry Point & Game Loopmap.lua - Navigation Graph (AI Road Map)screenshot.lua - Screenshot Systemserver/server - Level Loading & Game ServerserverConnection - Client-Server Connection Manager`setSpawnpoint` - Default Spawn Point Persistence`simTimeAuthority` - Simulation Time & Bullet Time Control`spawn` - Vehicle Spawning & Safe Placement`suspensionFrequencyTester` - Suspension Natural Frequency Analysis
ui/ambientSound - Ambient Sound Stream PlayerUI Apps ManagerUI AudioBindings LegendCamera Distance AppConsole (consoleNG)Credits MusicExternal App (WebSocket UI Server)Fade ScreenGame BlurGameplay App ContainersGrid SelectorLivery EditorMessages DebuggerMessages/Tasks App ContainersMission InfoPolice InfoTop BarUI ModsUI Navigation / MapVehicle Paint EditorVehicle Vicinity AppUI Visibility

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 Extensionsui

Vehicle Vicinity App

Sends nearby vehicle bounding box and coupler data to the UI each frame.

Sends nearby vehicle bounding box and coupler data to the UI each frame.


Overview

ui_vehicleVicinityApp provides real-time spatial data about all vehicles in the scene to the UI. Each frame it sends oriented bounding boxes, vehicle types, and fifth-wheel coupler positions for use by the vicinity/proximity UI app.

Extension path: lua/ge/extensions/ui/vehicleVicinityApp.lua


Exports (M)

FunctionSignatureDescription
onGuiUpdate(dtReal, dtSim, dtRaw)Sends vehicle vicinity data to UI each frame.
onVehicleSwitched()Invalidates coupler cache.
onVehicleSpawned()Invalidates coupler cache.

Internals

Data Format

Each frame triggers onVehicleVicinityData with:

{
  playerVehicleId = <id>,
  objects = {
    [vehId] = {
      centerX, centerY, centerZ,  -- OBB center
      sizeX, sizeY, sizeZ,        -- OBB full extents
      rotX,                        -- rotation angle (atan2)
      type = "vehicle"|"traffic"|"parked"|"trailer",
      couplers = { ... },          -- fifth-wheel coupler nodes
    }
  }
}

Vehicle Type Detection

Type is determined by checking vehicle fields:

  • veh.isTraffic == 'true' → "traffic"
  • veh.isParked == 'true' → "parked"
  • JBeam name contains "trailer" → "trailer"
  • Otherwise → "vehicle"

Coupler Cache

getCouplerPoints(veh, vehId) scans vehicle node data for nodes with couplerTag or tag containing "fifthwheel". Results are cached per vehicle ID. Live positions are updated each frame using veh:getNodePosition(node.cid).

Cache is invalidated on onVehicleSwitched and onVehicleSpawned.


How It Works

  1. Each GUI frame, iterates all scene objects via be:getObjectCount().
  2. Gets the spawn-world oriented bounding box for each vehicle.
  3. Determines type from vehicle metadata.
  4. Fetches/caches fifth-wheel coupler positions.
  5. Triggers onVehicleVicinityData with the complete data set.

Lua Examples

-- The UI listens for this guihook:
-- guihooks.trigger('onVehicleVicinityData', data)

-- Access from another extension (data is sent to UI, not typically read from Lua)

Hooks Triggered

HookPayloadWhen
onVehicleVicinityData (guihook){playerVehicleId, objects}Every GUI frame

Additional Exports

The following exports are available but not yet documented in detail:

  • M.onGuiUpdate
  • M.onVehicleSpawned
  • M.onVehicleSwitched

Vehicle Paint Editor

ImGui tool for editing metallic paint properties on the player vehicle.

UI Visibility

Controls visibility of the CEF and ImGui UI layers.

On this page

OverviewExports (M)InternalsData FormatVehicle Type DetectionCoupler CacheHow It WorksLua ExamplesHooks TriggeredAdditional Exports