Node Beam Export
Minimal exporter that dumps the current vehicle's node positions and beam connections to a JSON file.
Minimal exporter that dumps the current vehicle's node positions and beam connections to a JSON file.
Overview
util_nodeBeamExport exports the player vehicle's node/beam graph as a simple JSON file. Nodes include positions (converted to Z-up coordinate system) and optional names. Beams include their connected node IDs. Useful for external analysis or visualization tools.
Extension path: lua/ge/extensions/util/nodeBeamExport.lua
Exports (M)
| Function | Signature | Description |
|---|---|---|
exportFile | (filename) | Exports nodes/beams to JSON. Auto-suggests filename if nil. |
suggestFilename | () | Returns next available export_N.nbexport.json path. |
Internals
Output Format
{
"vehicle": {
"id": 12345,
"jbeam": "pickup",
"name": "pickup"
},
"nodes": [
{ "id": 0, "name": "ref", "pos": [1.0, 0.5, -0.3] },
{ "id": 1, "pos": [1.2, 0.6, -0.2] }
],
"beams": [
{ "id": 0, "n1": 0, "n2": 1 },
{ "id": 1, "n1": 1, "n2": 2 }
]
}Coordinate Conversion
Node positions are converted from BeamNG's Y-up to Z-up:
X = XY = Z(game Z → export Y)Z = -Y(game Y negated → export Z)
Filename Suggestion
suggestFilename() scans the vehicle directory for existing export_*.nbexport.json files and returns the next sequential number. Files are placed in the vehicle's base directory.
Data Sources
- Vehicle object:
getPlayerVehicle(0)- provides node positions viagetNodePosition(id). - Vehicle data:
core_vehicle_manager.getVehicleData(id)- provides node metadata (names) and beam connections.
How It Works
- Call
exportFile()with an optional filename. - The current vehicle's nodes and beams are read.
- Positions are coordinate-converted.
- JSON is written with pretty-printing.
Lua Examples
-- Export to auto-suggested filename
extensions.util_nodeBeamExport.exportFile()
-- Export to specific file
extensions.util_nodeBeamExport.exportFile('vehicles/pickup/my_export.nbexport.json')
-- Get suggested filename
local fn = extensions.util_nodeBeamExport.suggestFilename()
print(fn) -- "vehicles/pickup/export_1.nbexport.json"Additional Exports
M.exportFile- (undocumented)M.suggestFilename- (undocumented)
Map Tiles
Generates orthographic map tile images at multiple zoom levels for use with web map viewers (e.g., Leaflet). Includes an ImGui control panel with progress tracking.
Node Stream
WebSocket server that streams real-time vehicle node positions to connected clients. Also serves initial node positions and flexbody mapping data on request.