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
Activity ManagerAudio Bank ManagerAudio Ribbon SystemBus Route ManagerCamera SystemCore Chat (IRC)Core CheckpointsCore Command HandlerCoupler Camera ModifierDevices (RGB Peripherals)Dynamic PropsEnvironmentFlowgraph ManagerForestFun StuffGame ContextGame StateGround Marker ArrowsGround MarkersHardware InfoHighscoresHotlappingInventoryJob SystemLap TimesLevelsLoad Map CommandMetricsMod ManagerMultiseatMultiseat CameraMulti SpawnOnlinePaths (Camera Paths)Quick Access (Radial Menu)Recovery PromptRemote ControllerReplayRepositoryRope Visual TestScheme Command ServerCore SnapshotCore SoundsCore TerrainTraffic SignalsTrailer RespawnVehicle Active PoolingVehicle Bridge (GE ↔ VLua Communication)Vehicle MirrorsVehicle PaintsCore VehiclesVehicle TriggersVersion UpdateWeather SystemWindows Console
Vehicle ColorsVehicle In-Place EditVehicle ManagerVehicle MirrorVehicle Part Management

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 Extensionscorevehicle

Vehicle Manager

Central vehicle lifecycle manager: spawning, loading, physics, colors, and data access.

Central vehicle lifecycle manager: spawning, loading, physics, colors, and data access.


Overview

Extension: core_vehicle_manager - The primary vehicle management system. Handles the C++ spawn callback, JBeam loading (stage 1), physics initialization, material loading, vehicle data storage, color/paint updates, and debug tooling.


Public Functions

FunctionDescription
M.getPlayerVehicleData()Returns the vehicle bundle for player 0
M.getVehicleData(id)Returns the vehicle bundle for any vehicle ID
M.spawnPhysicsForVehicle(objID, vehicleObj, vehicleBundle)Sends vehicle data to physics engine
M.liveUpdateVehicleColors(objID, vehicleObj, index, paint)Applies paint to vehicle object and emits hook
M.setVehicleColorsNames(id, paintNames, optional)Sets paints by name from model paint definitions
M.queueAdditionalVehicleData(data, vehId)Queues extra data to be included in next spawn
M._spawnCCallback(objID, vehicleDir, configDataIn, reloading)Internal: C++ spawn callback
M.reloadVehicle(playerId)Reloads player vehicle
M.reloadAllVehicles()Reloads all vehicles
M.toggleModifyKey()Toggles the in-place edit window
M.getDebug() / M.setDebug(enabled) / M.toggleDebug()Debug spawn mode
M.setVehiclePaintsNames(id, paintNames, optional)Alias for setVehicleColorsNames

Event Handlers

HandlerDescription
M.onVehicleSwitched(oldID, newID, player)Tracks active player, releases clutch
M.onDespawnObject(id, isReloading)Clears vehicle data unless reloading
M.onClientEndMission()Invalidates materials cache
M.onFileChanged(filename, type)Invalidates JBeam/material caches
M.onSerialize() / M.onDeserialized(data)Persists vehicle data across Lua reloads
M.onUpdate()Clears spawn cache each frame

Vehicle Bundle Structure

Returned by getVehicleData():

{
  vdata = { ... },          -- JBeam processed vehicle data
  config = {
    parts = {},             -- part slot assignments
    paints = {},            -- paint table (up to 3 slots)
    partConfigFilename = "" -- source config path
  },
  mainPartName = "...",     -- root JBeam part name
  chosenParts = {},         -- slot → part name mapping
  activePlayer = 0,         -- active player index (or nil)
  ioCtx = { ... }          -- JBeam I/O context
}

Spawn Flow

  1. C++ calls _spawnCCallback(objID, vehicleDir, configData)
  2. Materials loaded from vehicle directory + /vehicles/common/
  3. Config built via core_vehicle_partmgmt.buildConfigFromString()
  4. JBeam stage 1 loaded via jbeam/loader.loadVehicleStage1()
  5. vehicleObj:finishConstructionGESide() completes mesh setup
  6. spawnPhysicsForVehicle() sends data to physics (unless NoPhysics)
  7. Vehicle auto-entered if autoEnterVehicle not "false"

Usage Examples

-- Get player vehicle data
local vd = core_vehicle_manager.getPlayerVehicleData()
if vd then
  log('I', '', 'Vehicle: ' .. tostring(vd.vdata.vehicleDirectory))
end

-- Live update paint
local paint = createVehiclePaint({x=1, y=0, z=0, w=1}, {})
core_vehicle_manager.liveUpdateVehicleColors(vehId, nil, 1, paint)

-- Reload current vehicle
core_vehicle_manager.reloadVehicle(0)

Hooks Emitted

HookWhen
onSpawnCCallbackDuring spawn, before JBeam loading
onVehicleColorChangedAfter live color update

Editor Integration

HandlerDescription
M.onEditorInitialized()Registers the Vehicle Manager editor window
M.onEditorGui()Renders obsolete editor window with deprecation notice

Module Properties

PropertyDefaultDescription
M.autoSpawnPhysicstrueWhether physics auto-starts on spawn

See Also

  • Vehicle Colors - Color/paint utilities
  • Vehicle In-Place Edit - Part editing tool
  • Vehicle Mirror - Mirror angle management

Vehicle In-Place Edit

In-game vehicle part editor with keyboard-driven navigation and live part swapping.

Vehicle Mirror

Manages vehicle mirror angle offsets with mouse interaction and per-config persistence.

On this page

OverviewPublic FunctionsEvent HandlersVehicle Bundle StructureSpawn FlowUsage ExamplesHooks EmittedEditor IntegrationModule PropertiesSee Also