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)| Parameter | Type | Description |
|---|---|---|
vehicle | object | BeamNG vehicle object |
missionDir | string | Mission directory path |
Methods
| Method | Signature | Returns | Description |
|---|---|---|---|
truncateCapturesFile | () | nil | Clear the driveline file (write mode "w") |
writeCaptures | (force) | nil | Flush buffer to file (auto-flushes at 10+ entries) |
capture | () | nil | Sample current vehicle state, buffer if distance threshold met |
drawDebug | () | nil | Draw blue sphere at last captured position |
Internals
interval_m: Distance threshold between captures (default2meters)last_dist_pos: Last position where a capture was recordedcapturesBuffer: In-memory buffer of capture objects before writingfname: 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
- On
init, registers for steering value change notifications viacore_vehicleBridge capture()is called each frame - measures distance from last recorded position- If distance exceeds
interval_m(2m), records position, rotation, steering, and timestamp - Buffer is appended to the JSONL file when it reaches 10 entries or on forced flush
- 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.