Track Builder - Basic Borders
Generates left and right border mesh geometry for track segments in the track builder system.
Generates left and right border mesh geometry for track segments in the track builder system.
Overview
util_trackBuilder_basicBorders provides border cross-section shapes (regular, bevel, racetrack, rail, etc.) and compiles them into 3D mesh data (vertices, normals, UVs, faces) for track segment borders. Each side of the track gets an independent mesh with configurable shape and material.
Module path: lua/ge/extensions/util/trackBuilder/basicBorders.lua
Exports (M)
| Function | Signature | Description |
|---|---|---|
getMeshes | (segment) → table | Returns an array of left and right border mesh data tables for the segment. |
Internals
Available Shapes
| Shape | Description |
|---|---|
regular | Standard barrier profile with curved top. |
bevel | Rounded quarter-circle profile. |
smoothedRect | Thin rectangular profile with smoothed edges. |
racetrack | Wide racetrack barrier with raised wall section. |
smallDiagonal | Small diagonal wall profile. |
bigDiagonal | Larger diagonal wall profile. |
wideBevel | Wide barrier with parabolic top curve. |
highBevel | Tall barrier with high parabolic top. |
rail | Circular rail tube mounted on a flat base. |
none | Invisible / no border (just two edge points). |
Shape Structure
Each shape defines:
crossPoints- array of{point = vec3, uv = number, sharp = bool}defining the 2D profile.cap- triangle indices for start/end caps.faces- groups of vertex indices forming face strips.faceInfo- precomputed face/normal/cap data (computed on module load).
Mesh Compilation (compileMeshInfo)
For each track point that passes the quality filter:
- Cross-section vertices are transformed into world space using the point's orientation, width, and position.
- Normals are rotated similarly.
- UVs use the cross-section
uvfor U andpoint.uvY * uvHeightfor V. - Faces connect consecutive cross-sections into quads.
- Optional start/end caps are added based on segment
meshInfo.
Quality Levels
At quality level 4, borders degrade to the none shape (invisible).
Output Format
{
verts = {{x,y,z}, ...},
uvs = {{u,v}, ...},
normals = {{x,y,z}, ...},
faces = {{v, n, u}, ...},
material = "track_editor_A_border",
tag = "side 1" or "side -1"
}How It Works
- Track builder assigns
leftMeshandrightMeshshape names to each segment. getMeshes(segment)compiles both sides into mesh data.- The mesh data is passed to the ProceduralMesh system for rendering.
Lua Examples
-- Used internally by the track builder pipeline:
local borderMeshes = extensions.util_trackBuilder_basicBorders.getMeshes(segment)
-- Returns array: {leftMeshData, rightMeshData}Additional Exports
M.getMeshes- (undocumented)
util/wsTest - WebSocket Test Server
Reference for `extensions/util/wsTest.lua`. Runs a local WebSocket server for testing GE Lua execution, reloads, and bandwidth measurements from a browser.
Track Builder - Basic Centers
Generates center road surface mesh geometry for track segments in the track builder system.