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

Sensors Module Reference

Module defined in `lua/vehicle/sensors.lua`. Provides real-time physical sensor data (G-forces, angular velocities, orientation) with optional temporal smoothing. Used by AI for driving decisions, by the UI for G-force meters, and by extensions for impact detection and stability monitoring. Reads directly from the C++ physics engine via FFI for maximum performance.

Module defined in lua/vehicle/sensors.lua. Provides real-time physical sensor data (G-forces, angular velocities, orientation) with optional temporal smoothing. Used by AI for driving decisions, by the UI for G-force meters, and by extensions for impact detection and stability monitoring. Reads directly from the C++ physics engine via FFI for maximum performance.

See Also

  • Electrics: For values derived from sensors.
  • CommonPatterns: For impact detection recipes using sensors.

State Fields

VariableDescription
ffiSensorsRaw FFI pointer to engine sensor data. Fields: gx, gy, gz: Acceleration. yawAngVel, pitchAngVel, rollAngVel: Angular velocities. sensorX, sensorY, sensorZ: Absolute orientation vectors.
gx, gy, gzInstantaneous G-forces in the vehicle's local frame.
gx2, gy2, gz2Smoothed G-forces (filter rate 7). Use these for UI or logic that needs stable acceleration data.

Public API

FunctionSignatureDescription
init()Obtains FFI pointer and resets smoothers.
reset()Resets temporal filters.
updateGFX(dt)Updates instantaneous and smoothed physical values.

Usage Example

-- Read instantaneous G-forces (vehicle-local frame)
local lateralG = sensors.gx  -- Side-to-side
local longitudinalG = sensors.gy  -- Front-to-back (braking/accel)
local verticalG = sensors.gz  -- Up-down (bumps, jumps)

-- Use smoothed values for UI or stable logic
local totalG = math.sqrt(sensors.gx2^2 + sensors.gy2^2 + sensors.gz2^2) / 9.81

-- High-performance FFI access for physics-step code
local s = sensors.ffiSensors
local yawRate = s.yawAngVel  -- rad/s

ScriptAI Module Reference

Module defined in `lua/vehicle/scriptai.lua`. Handles high-fidelity path recording and playback for cinematic sequences and scripted behavior.

Sounds Module Reference

Module defined in `lua/vehicle/sounds.lua`. This module interfaces with the game's audio engine to handle impacts, scrapes, wind, tires, and the JBeam soundscape. It also provides a wrapper for manage

On this page

See AlsoState FieldsPublic APIUsage Example