RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Auto AnnotationBoosterCalibrate ESCCompile ImpostersCompile MeshesConfig List GeneratorDecal Roads EditorDependency TreeDoc CreatorVehicle ExporterFollow The White RabbitForest GeneratorGround Model DebugInput System UtilsInstanced Line Render DemoJBeam StatsLog StreamsMap TilesNode Beam ExportNode StreamPhotomodePrecompile ShadersPrecompile VehiclesProcedural Track GeneratorRectangle GeneratorRender Components APIResave MaterialsRich PresenceSave Dynamic DataScreenshot CreatorShowroomSort LinesStep HandlerTerrain GeneratorTest Extension ProxiesTest JSON Files SyntaxVehicle Rope DebugBatch WorkerWebSocket Test
Basic BordersBasic CentersBorder Wall MeshCamera TransitionCeiling MeshTrack MarkersMaterial UtilTrack MeshesMulti Track MergerObstacle PlacerTrack PiecesProcedural PrimitivesQuickrace SetupSegment To Procedural MeshSpline Track

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 ExtensionsutiltrackBuilder

Segment To Procedural Mesh

Reference for `extensions/util/trackBuilder/segmentToProceduralMesh.lua`. Converts track segments (with computed spline points) into ProceduralMesh objects rendered in the scene.

Reference for extensions/util/trackBuilder/segmentToProceduralMesh.lua. Converts track segments (with computed spline points) into ProceduralMesh objects rendered in the scene.


Exports

KeySignatureDescription
materialize(segment)Generates and applies the procedural mesh for a segment
calculatePointCoordinateSystem(segment)Computes per-point orientation vectors (nx, ny, nz)
compileMeshInfo(segment, lod?)Collects mesh data from all sub-generators
rotateVectorByQuat(v, q) → vec3Vector rotation helper
clearShapes()Clears cached shape data in basicCenters
getReferences() → tableReturns {basicCenters, basicBorders} for use by other modules

Internals

  • Sub-generators imported via require:
    • basicCenters - center road surface mesh
    • basicBorders - border/edge strip mesh
    • borderWall - side wall mesh
    • ceilingMesh - overhead ceiling mesh
  • Coordinate system: For each control point with sufficient quality level, computes three orthogonal vectors from finalRot: nx (right), ny (forward), nz (up).
  • LOD: Three detail levels are stored, but currently all set to the same mesh (meshes[1] = meshes[2] = meshes[3]).
  • ProceduralMesh creation: If the segment has no existing mesh object, one is created and registered in MissionGroup. Otherwise, the existing object is updated via createMesh.

Internal State

FieldTypeDescription
M.settingsvariesAssigned as settings


How It Works

  1. materialize(segment) is called after spline points and interpolation values are computed.
  2. calculatePointCoordinateSystem derives orientation vectors for each point.
  3. compileMeshInfo gathers meshes from all four sub-generators (centers, borders, walls, ceiling).
  4. The combined mesh array is passed to ProceduralMesh:createMesh() for rendering.
  5. Submesh indexes are tracked in segment.submeshIndexes for per-submesh material assignment.
-- After spline computation and interpolation:
mesher.materialize(segment)
-- segment.mesh now holds a ProceduralMesh scene object

-- Access sub-generator references for intersection merging:
local refs = mesher.getReferences()
-- refs.basicCenters, refs.basicBorders

Additional Exports

  • M.calculatePointCoordinateSystem - (undocumented)
  • M.clearShapes - (undocumented)
  • M.compileMeshInfo - (undocumented)
  • M.getReferences - (undocumented)
  • M.materialize - (undocumented)
  • M.rotateVectorByQuat - (undocumented)

See Also

  • Track Builder - Basic Borders - Related reference
  • Track Builder - Basic Centers - Related reference
  • Track Builder - Border Wall Mesh - Related reference
  • Game Engine Overview - Guide

Quickrace Setup

Reference for `extensions/util/trackBuilder/quickraceSetup.lua`. Loads a saved track and sets up checkpoints/vehicle positioning when a quick race scenario starts.

Spline Track

Reference for `extensions/util/trackBuilder/splineTrack.lua`. The central module of the track editor - manages track pieces, converts them to spline geometry, handles markers, materials, checkpoints,

On this page

ExportsInternalsInternal StateHow It WorksAdditional ExportsSee Also