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

Procedural Primitives

Reference for `extensions/util/trackBuilder/proceduralPrimitives.lua`. Generates mesh data (vertices, normals, UVs, faces) for primitive 3D shapes used as track obstacles.

Reference for extensions/util/trackBuilder/proceduralPrimitives.lua. Generates mesh data (vertices, normals, UVs, faces) for primitive 3D shapes used as track obstacles.


Exports

KeySignatureDescription
createRing(radius, thickness, material?) → meshTorus/ring shape
createCylinder(radius, height, material?) → meshCylinder with top/bottom caps
createCube(size, material?, uvStyle?) → meshBox with configurable UV layout
createCone(radius, height, material?) → meshCone with flat bottom
createBump(length, width, height, upperLength, upperWidth, material?) → meshTrapezoidal bump
createRamp(width, len, hei, thinning, attack, twist, material?) → meshRamp with configurable taper and curve

Internals

Mesh Format

All functions return a table with:

  • verts: {{x,y,z}, ...} - vertex positions
  • normals: {{x,y,z}, ...} - normal vectors
  • uvs: {{u,v}, ...} - texture coordinates
  • faces: {{v=idx, n=idx, u=idx}, ...} - triangle faces (0-indexed)
  • material: string - material name (default 'track_editor_A_border')

Shape Details

  • Ring: Generates a torus by sweeping an inner circle around an outer circle. Segment counts adapt to radius/thickness.
  • Cylinder: Side faces, top cap, and bottom cap. UV repeats based on height.
  • Ramp: Segmented along length with per-segment thinning and power-curve attack angle. Includes front/back end caps.
  • Bump: 8-vertex frustum shape (bottom rect → top rect) with analytical face normals.
  • Cone: Radial fan faces converging to apex plus flat bottom cap.
  • Cube: Two UV styles available (style 1 = standard, style 2 = rotated side UVs).

The module also contains an unexported createIcosphere function for debugging (creates and registers a ProceduralMesh directly).


How It Works

Each generator computes geometry analytically, with adaptive segment counts clamped to reasonable ranges. The mesh tables are consumed by ProceduralMesh:createMesh().

local prims = require('util/trackBuilder/proceduralPrimitives')

-- Create a ring obstacle
local ringMesh = prims.createRing(2, 0.5, 'track_editor_A_border')

-- Create a ramp: 5m wide, 10m long, 2m high, slight taper
local rampMesh = prims.createRamp(5, 10, 2, 0.5, 1.5, 0, 'track_editor_B_border')

-- Use with ProceduralMesh
local proc = createObject("ProceduralMesh")
proc:registerObject('myObstacle')
proc:createMesh({{ringMesh}})

Additional Exports

  • M.createBump - (undocumented)
  • M.createCone - (undocumented)
  • M.createCube - (undocumented)
  • M.createCylinder - (undocumented)
  • M.createRamp - (undocumented)
  • M.createRing - (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 Pieces

Reference for `extensions/util/trackBuilder/pieces.lua`. Converts abstract track piece descriptions (forward, curve, spiral, loop, bezier) into concrete segment data with positions, headings, and cont

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.

On this page

ExportsInternalsMesh FormatShape DetailsHow It WorksAdditional ExportsSee Also