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

Multi Track Merger

Reference for `extensions/util/trackBuilder/multiTrackMerger.lua`. Creates procedural meshes at intersection points where multiple track segments meet, filling the gaps with bezier-interpolated surfac

Reference for extensions/util/trackBuilder/multiTrackMerger.lua. Creates procedural meshes at intersection points where multiple track segments meet, filling the gaps with bezier-interpolated surfaces.


Exports

KeySignatureDescription
mergeMultiTrack(segments, centerMat?, borderMat?, borderMesh?) → objCreates a merged intersection mesh from multiple track endpoints
setReferences(list)Sets references to basicCenters and basicBorders mesh generators
setMaterials(intersection, center?, border?)Updates materials on an existing intersection object

Internals

  • Bezier edge generation: bezierEdge(a, b, center) creates a cubic bezier curve between two track endpoints, using their orientation vectors as control point tangents. Interpolates bank, width, and pitch along the curve.
  • Plate mesh generation: makePlateMesh(leftEdge, rightEdge, center, mat, bottom) creates a triangulated surface between two bezier edges and a center point. Generates both top and bottom faces.
  • Center mesh: getCenterMesh(edges, mat) fills the center area of multi-way intersections (3+ segments) with plate meshes.
  • Point coordinate system: Each bezier point gets nx/ny/nz orientation vectors computed from its final rotation quaternion.

How It Works

  1. mergeMultiTrack receives a list of segment endpoints (with position, rotation, width, bank data).
  2. Endpoints are sorted by angle around their centroid for correct winding order.
  3. Bezier edges are computed between consecutive endpoints using bezierEdge.
  4. For each edge, center and border meshes are generated using the same mesh generators as regular track segments.
  5. For 3+ way intersections, additional fill meshes close the center gap.
  6. All meshes are combined into a single ProceduralMesh object registered in MissionGroup.
-- Create an intersection between track endpoints
local segments = {
  {index = 5, sub = 1, segment = track[5], reverse = false},
  {index = 3, sub = 2, segment = track2[3], reverse = true},
}
local obj = merger.mergeMultiTrack(segments, 'track_editor_A_center', 'track_editor_A_border')

Additional Exports

  • M.mergeMultiTrack - (undocumented)
  • M.setMaterials - (undocumented)
  • M.setReferences - (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

Track Meshes

Reference for `extensions/util/trackBuilder/meshes.lua`. Defines cross-section profiles (tubes and side walls) used by the track builder's procedural mesh system.

Obstacle Placer

Reference for `extensions/util/trackBuilder/obstaclePlacer.lua`. Places static and procedural obstacles (rocks, ramps, rings, etc.) along track segments.

On this page

ExportsInternalsHow It WorksAdditional ExportsSee Also