API ReferenceGE Extensionsgameplayrally
Rally Cut Capture
Captures vehicle position/rotation snapshots ("cuts") during recce recording sessions. Each cut is written as a JSON line to a file for later processing by the transcription pipeline.
Captures vehicle position/rotation snapshots ("cuts") during recce recording sessions. Each cut is written as a JSON line to a file for later processing by the transcription pipeline.
Constructor
local CutCapture = require('/lua/ge/extensions/gameplay/rally/cutCapture')
local cc = CutCapture(vehicle, missionDir)Public API
| Method | Signature | Returns | Description |
|---|---|---|---|
init | (vehicle, missionDir) | nil | Initializes capture with vehicle and output file paths |
capture | () | number | Captures current vehicle state and writes to file; returns cut ID |
truncateCapturesFile | () | nil | Clears the cuts output file |
truncateTranscriptsFile | () | nil | Clears the transcripts output file |
writeCut | (cutCapture) | nil | Appends a JSON-encoded cut to the file |
Internals
| Field | Type | Description |
|---|---|---|
vehicle | object | BeamNG vehicle object reference |
fname | string | Path to cuts JSON-lines file |
fname_transcripts | string | Path to transcripts file |
cut_id | number | Auto-incrementing cut counter |
Cut Data Structure
Each captured cut contains:
| Field | Type | Description |
|---|---|---|
id | number | Sequential cut ID |
ts | number | Timestamp from rallyUtil.getTime() |
pos | table | Vehicle position {x, y, z} |
quat | table | Vehicle rotation quaternion {x, y, z, w} |
steering | number/nil | Current steering input value (from vehicle bridge) |
How It Works
- On
init, registers a value change notification for thesteeringkey viacore_vehicleBridge capture()reads the vehicle's position, direction quaternion, and cached steering value- The cut is JSON-encoded and appended as a line to the cuts file
- Cut IDs auto-increment for sequential ordering
- Steering data is retrieved from
core_vehicleBridge.getCachedVehicleData
Usage Examples
-- Initialize for a recce session
local cc = CutCapture(playerVehicle, missionDir)
cc:truncateCapturesFile()
-- Capture on user input (e.g., button press)
local cutId = cc:capture()
log('I', '', 'Captured cut #' .. cutId)Notes
- Files use JSON-lines format (one JSON object per line) for easy streaming
- The vehicle position is centered over the top center of the windshield
- Output path is determined by
rallyUtil.missionReccePath(missionDir, 'cuts.json') - Steering is optional and will be nil if the vehicle bridge hasn't cached the value
See Also
- Rally Audio Manager - Related reference
- Rally Camera Path Player - Related reference
- Rally Client - Related reference
- Gameplay Systems Guide - Guide
Rally Client
HTTP client for communicating with a local rally companion server. Sends recording cut commands and retrieves transcription results via REST API on `localhost:27872`.
Rally Enums
Defines enumeration constants for the rally system: pacenote audio modes, trigger types, and slow corner release types.