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

Basic Centers

Generates center road surface mesh geometry for track segments in the track builder system.

Generates center road surface mesh geometry for track segments in the track builder system.


Overview

util_trackBuilder_basicCenters provides center road cross-section shapes (regular, flat, low, halfRegular) and compiles them into 3D mesh data. Uses a width-based LUT (look-up table) system so normals and vertices are precomputed per width step for performance.

Module path: lua/ge/extensions/util/trackBuilder/basicCenters.lua


Exports (M)

FunctionSignatureDescription
getMeshes(segment) → tableReturns an array containing the center road mesh for the segment.
clearShapes()Clears all precomputed LUT data for all shapes.

Internals

Available Shapes

ShapeDescription
regularFull road profile with raised bumps on top and bottom edges (12 cross-points).
halfRegularHalf-width version of regular (7 cross-points).
flatSimple flat rectangle (4 cross-points).
lowSimplified low-profile road (6 cross-points).

Width-Based LUT System

Unlike borders (which use fixed-width shapes), center meshes vary width per point. The system precomputes vertex positions and normals for each discrete width step:

  1. computeNormals(segment, shape) - scans segment points for min/max width.
  2. For each needed width (in LUTDetail = 10 subdivisions per unit), computes:
    • Scaled vertex positions from cross-section points.
    • Smooth or sharp normals depending on crossPoints[i].sharp.
    • UV X coordinates relative to uvCenterIndex.
  3. Cached in shape.vertexLUT[scaledWidth].

UV Mapping

  • U axis: Distance along the cross-section from center, scaled by uv.width = 0.2.
  • V axis: point.uvY * uv.height (along-track distance).

Each shape defines uvCenterIndex - indices whose UV X is treated as zero.

Mesh Compilation

compileMeshInfo(segment, shape):

  1. For each quality-filtered point, looks up the LUT entry for the point's width.
  2. Transforms vertices/normals into world space using the point's orientation.
  3. Builds face indices connecting consecutive cross-sections.
  4. Adds start/end caps if configured.

Quality Fallback

At quality level 4, all shapes fall back to low.

Output Format

{
  verts = {{x,y,z}, ...},
  uvs = {{u,v}, ...},
  normals = {{x,y,z}, ...},
  faces = {{v, n, u}, ...},
  material = "track_editor_A_center",
  tag = "center"
}

How It Works

  1. Track builder assigns a centerMesh shape name to each segment.
  2. getMeshes(segment) computes width-dependent normals, then compiles the mesh.
  3. LUT caching means repeated widths are fast.
  4. Call clearShapes() to reset caches when track parameters change.

Lua Examples

-- Used internally by track builder:
local centerMeshes = extensions.util_trackBuilder_basicCenters.getMeshes(segment)
-- Returns array: {centerMeshData}

-- Clear LUT cache after parameter changes
extensions.util_trackBuilder_basicCenters.clearShapes()

Additional Exports

  • M.clearShapes - (undocumented)
  • M.getMeshes - (undocumented)

See Also

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

Basic Borders

Generates left and right border mesh geometry for track segments in the track builder system.

Border Wall Mesh

Generates vertical wall meshes for left and right track borders with configurable height.

On this page

OverviewExports (M)InternalsAvailable ShapesWidth-Based LUT SystemUV MappingMesh CompilationQuality FallbackOutput FormatHow It WorksLua ExamplesAdditional ExportsSee Also