RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Gameplay AchievementGameplay CityDiscoverForce FieldGarage ModeMarker InteractionParking SystemGameplay Playmode MarkersGameplay PoliceGameplay RallyGameplay Rally LoopGameplay Raw POIsGameplay Skidpad TestSpeed Trap LeaderboardsSpeed Traps and CamerasGameplay StatisticsTaxi Ride SystemTraffic SystemVehicle PerformanceWalking
Rally Audio ManagerRally Camera Path PlayerRally ClientRally Cut CaptureRally EnumsRally Extension HelperRally GeometryRally ManagerRecce ManagerRecce AppRecce SettingsRally Settings ManagerSnap-to-RoadTraffic Exclusion ZonesRally UtilityRally Vehicle CaptureRally Vehicle Tracker

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 Extensionsgameplayrally

Rally Vehicle Capture

Class that records vehicle position, rotation, and steering data at distance-based intervals during a recce drive. Writes data to a JSONL driveline file.

Class that records vehicle position, rotation, and steering data at distance-based intervals during a recce drive. Writes data to a JSONL driveline file.


Constructor

local VehicleCapture = require('gameplay/rally/vehicleCapture')
local capture = VehicleCapture(vehicle, missionDir)
ParameterTypeDescription
vehicleobjectBeamNG vehicle object
missionDirstringMission directory path

Methods

MethodSignatureReturnsDescription
truncateCapturesFile()nilClear the driveline file (write mode "w")
writeCaptures(force)nilFlush buffer to file (auto-flushes at 10+ entries)
capture()nilSample current vehicle state, buffer if distance threshold met
drawDebug()nilDraw blue sphere at last captured position

Internals

  • interval_m: Distance threshold between captures (default 2 meters)
  • last_dist_pos: Last position where a capture was recorded
  • capturesBuffer: In-memory buffer of capture objects before writing
  • fname: Output file path (<missionDir>/rally/recce/primary/driveline.json)

Capture Data Format

Each capture is a JSON line:

{
  "ts": 1234567.89,
  "pos": {"x": -394.07, "y": 67.10, "z": 51.20},
  "quat": {"x": -0.01, "y": -0.01, "z": 0.99, "w": 0.16},
  "steering": -190.27
}

How It Works

  1. On init, registers for steering value change notifications via core_vehicleBridge
  2. capture() is called each frame - measures distance from last recorded position
  3. If distance exceeds interval_m (2m), records position, rotation, steering, and timestamp
  4. Buffer is appended to the JSONL file when it reaches 10 entries or on forced flush
  5. Steering value comes from core_vehicleBridge.getCachedVehicleData
local capture = VehicleCapture(be:getPlayerVehicle(0), missionDir)

-- In update loop
capture:capture()

-- Force write remaining data at end of recording
capture:writeCaptures(true)

Dependencies

  • gameplay/rally/util - missionReccePath(), getTime()
  • core_vehicleBridge - steering value subscription

See Also

  • Rally Audio Manager - Related reference
  • Rally Camera Path Player - Related reference
  • Rally Client - Related reference
  • Gameplay Systems Guide - Guide

Rally Utility

Central utility module for the rally system. Provides constants, file path helpers, mission detection, notebook loading, corner call classification, string utilities, vehicle geometry helpers, and tim

Rally Vehicle Tracker

Class that tracks the player vehicle's position, velocity, speed, and damage during rally gameplay. Provides damage detection with configurable threshold.

On this page

ConstructorMethodsInternalsCapture Data FormatHow It WorksDependenciesSee Also