RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

AI Module ReferenceBackwards Compatibility Module ReferenceBdebug Module ReferenceBdebugImpl Module ReferenceBeamstate Module ReferenceBullettime Module ReferenceController Module ReferenceDamageTracker Module ReferenceDrivetrain Module ReferenceElectrics Module ReferenceElectrics Custom Value ParserEnergyStorage Module ReferenceExtensions Module ReferenceFire Module ReferenceVehicle Engine True GlobalsGuihooks Module ReferenceGUI Streams Module ReferenceHTML Texture Module ReferenceHydros Module ReferenceInput Module ReferenceJBeam-Lua Integration GuideMapmgr Module ReferenceMaterial Module ReferenceBeamNG Math & Unit Conversions Referenceobj (Vehicle C++ Object)PartCondition Module ReferenceParticlefilter Module ReferenceParticles Module ReferencePowertrain Module ReferenceVehicle Property & Module TreeProps Module ReferenceProtocols Module ReferenceRecovery Module ReferenceScriptAI Module ReferenceSensors Module ReferenceSounds Module ReferenceStreams Module ReferenceThrusters Module Reference`v` (Vehicle Data & JBeam)Wheels Module Reference

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 Referenceve

Powertrain Module Reference

Module defined in `lua/vehicle/powertrain.lua`. This is the physical powertrain simulation engine, managing the interconnected tree of [Devices](/docs/api/ve/powertrain/FOLDER_OVERVIEW) (engines, transmissions,

Module defined in lua/vehicle/powertrain.lua. This is the physical powertrain simulation engine, managing the interconnected tree of Devices (engines, transmissions, differentials, shafts, and wheels).

See Also

  • Powertrain Folder: Detailed component references.
  • EnergyStorage: For fuel/battery interaction.
  • Electrics: For RPM/Gear values on the bus.

Public API - Core Module

Standard hooks and dispatchers used by the vehicle engine.

FunctionSignatureDescription
powertrain.init() / reset()Primary initialization and reset. Builds the connection tree and calculates inertias.
powertrain.update(dt)Core physics loop: calculates leaf-to-root velocities followed by root-to-leaf torques.
powertrain.updateGFX(dt) / updateGFXLastStage(dt)Frame-rate updates for environment sync, damage checks, and GFX state.

Environment & Global State

Live environmental constants affecting powertrain performance.

VariableTypeDescription
currentEnvPressurenumberAtmospheric pressure in Pa.
currentEnvTemperaturenumberTemperature in Kelvin.
currentEnvTemperatureCelsiusnumberTemperature in °C.
currentGravitynumberGravity magnitude (e.g., -9.81).
stabilityCoefnumberPhysics stability factor (default 250).
torqueReactionCoefstableArray of torque reaction coefficients.
cumulativeGearRationumberMaximum gear ratio present in the tree.
engineDatatablePhysical limits and reaction nodes for engines.

Public API - Device Management

Functions for finding and interacting with powertrain devices.

FunctionSignatureDescription
powertrain.dumpsDeviceData(device) / serializeDevicesInfo()Debug utilities for exporting the current powertrain state. Returns serialize(serializeInfoRes).
powertrain.getDevice(name)Returns the device object with the specified name.
powertrain.getDevicesByCategory(category) / getDevicesByType(type)Returns an array of devices matching the criteria (e.g., "engine", "differential").
powertrain.getOrderedDevices()Returns the list of devices in leaf-to-root update order.
powertrain.getPoweredWheelNames()Returns a map of wheel names to their propulsion device names.
powertrain.getPropulsionDeviceForWheel(name) / getPropulsionDeviceForDevice(device)Traverses the tree to find the root engine for a specific component. Returns nil --didn't find anything....
powertrain.getChildWheels(deviceName)Returns a list of all wheels connected downstream of a device.
powertrain.getHydraulicConsumer(name)Locates a device using hydraulic power (e.g., pumps, cylinders).
powertrain.getPartCondition(partName)Returns part condition data. Returns table.
powertrain.setPartCondition(partTypeData, odometer, integrity, visual)Sets the condition for powertrain parts.
powertrain.getEngineSoundID()Generates a unique numeric ID for engine sound registration.
powertrain.setDeviceMode(name, mode) / toggleDeviceMode(name)Changes the operating mode of a device (e.g., locking a differential). Returns newMode.
powertrain.breakDevice(device)Manually forces a device into a broken state and snaps associated JBeam beams.

Brake & Energy Systems


Engine Specific (ICE)

These functions specifically target combustion engine behaviors.


Public API - Exhaust & Sound

FunctionSignatureDescription
powertrain.updateSounds(dt)Main dispatcher for audio simulation updates.

Public API - UI & Interface

FunctionSignatureDescription
powertrain.sendDeviceTree()Exports the physical topology of the powertrain to the UI.
powertrain.updateSimpleControlButtons()Refreshes UI button states for powertrain-linked features.

Public API - Logic & State Management

FunctionSignatureDescription
powertrain.getState() / setState(state)Interface for saving/restoring logical state.
powertrain.publishStateEvent(event) / triggerStateEvent(event)Dispatchers for logic-triggered events (e.g., differential lock changes).

Wheels Reference

Access via powertrain.wheels[wheelName] (e.g., FL, FR, RL, RR).

Core Properties

  • cid: BeamNode ID.
  • obj: Physical C++ wheel object.
  • radius / dynamicRadius: Static and live tire radius (m).
  • angularVelocity: Current rotation speed (rad/s).
  • propulsionTorque: Current torque from engine (Nm).
  • brakingTorque: Current torque from brakes (Nm).
  • downForce: Vertical load on the tire (N).
  • isBroken / isPunctured / isTireDeflated: Status flags.

Thermals

  • brakeCoreTemperature: Temperature of the brake disc (°C).
  • brakeSurfaceTemperature: Temperature of the pad/surface interface (°C).
  • brakeMeltingPoint: Thermal failure threshold.

Generic Device Structure

All powertrain devices (Engines, Transmissions, Drivelines) share these properties:

Properties

  • name: Unique identifier.
  • type: Device implementation (e.g., "combustionEngine", "differential").
  • mode: Current operating state.
  • cumulativeGearRatio: Total ratio from this device to the wheels.
  • isBroken / isPhysicallyDisconnected: Operational flags.
  • children: List of downstream devices.

Public API - Methods

  • device:calculateInertia(): Recalculates downstream mass.
  • device:onBreak(): Internal callback for structural failure.
  • device:setMode(mode): External interface to change behavior.
  • device:applyDeformGroupDamage(damage): Visual damage integration.

Hooks

FunctionSignatureDescription
module.initSounds()Initializes sound resources.
module.resetSounds()Resets sound state.
module.onCouplerFound(nodeId, obj2id, obj2nodeId, nodeDist)Callback for coupler found event.
module.onCouplerAttached(nodeId, obj2id, obj2nodeId, attachSpeed, attachEnergy)Callback for coupler attached event.
module.onCouplerDetached(nodeId, obj2id, obj2nodeId, breakForce)Callback for coupler detached event.
module.calculateTreeInertia()iterate starting at the wheels for various calculations throughout the tree(s)
module.toggleDefaultDiffs()Toggles default diffs.
module.getAllWheelPropulsionDevices()Returns the all wheel propulsion devices. Returns propulsionDevices.
module.setVehiclePath(path)Sets the vehicle path.
module.getStateEvents()Returns the state events. Returns stateEvents.
module.isPhysicsStepUsed()Checks if physics step used. Returns hasPowertrain.

Particles Module Reference

Module defined in `lua/common/particles.lua`. Manages the global registry of material-to-particle interaction rules. Defines which particle effects (dust, sparks, mud, snow) are spawned when specific material pairs interact during collisions, tire contact, or scraping. Shared across both GE and VE contexts.

Vehicle Property & Module Tree

Quick reference for common object hierarchies and their access paths in Vehicle Lua.

On this page

See AlsoPublic API - Core ModuleEnvironment & Global StatePublic API - Device ManagementBrake & Energy SystemsEngine Specific (ICE)Public API - Exhaust & SoundPublic API - UI & InterfacePublic API - Logic & State ManagementWheels ReferenceCore PropertiesThermalsGeneric Device StructurePropertiesPublic API - MethodsHooks