API ReferenceGE ExtensionseditortechroadArchitect
Road Architect - Static Mesh
Places static meshes (TSStatic objects) along road lanes - both spanning meshes repeated along length and single-unit patch meshes at specific positions.
Places static meshes (TSStatic objects) along road lanes - both spanning meshes repeated along length and single-unit patch meshes at specific positions.
Public API
| Function | Signature | Description |
|---|---|---|
M.createStaticMeshes | (r, roadIdx, folder) | Creates all static meshes for a road based on its profile layers |
M.tryRemove | (roadName) | Removes all static meshes for the given road name |
Key Internals
| Function | Description |
|---|---|
createSelectedMesh | Places spanning meshes along a lane at regular intervals with optional spacing/jitter |
createSingleMeshUnit | Places a single mesh at a specific longitudinal position on the road |
computePolylineLengths | Computes cumulative lengths along a polyline |
Code Example
local staticMeshMgr = require('editor/tech/roadArchitect/staticMesh')
-- Create static meshes for a road inside a scene folder
local folder = createObject("SimGroup")
folder:registerObject("Road Architect - Road 1")
scenetree.MissionGroup:addObject(folder)
staticMeshMgr.createStaticMeshes(road, 1, folder)
-- Remove static meshes
staticMeshMgr.tryRemove(road.name)
-- Layer types that trigger static mesh creation:
-- layerType == 4 → spanning mesh (repeated along road length)
-- layerType == 5 → single mesh unit (placed at specific position)
-- Spanning mesh placement algorithm:
-- 1. Collect lane edge positions from renderData
-- 2. Compute polyline lengths
-- 3. Place mesh units at intervals of (meshLength + extraSpacing)
-- 4. Orient each mesh using tangent vector and normal
-- 5. Apply pre-rotation (0°/90°/180°/270°) and random jitter
-- Single mesh placement:
-- 1. Evaluate longitudinal position as fraction of road length
-- 2. Interpolate between div points for position/normal/lateral
-- 3. Apply vertical and lateral offsets
-- 4. Compute rotation from road frame + pre-rotation
-- Pre-rotation quaternions:
-- rot_q0 = quat(0,0,0,1) -- 0°
-- rot_q90 = quat(0,0,√2/2,√2/2) -- 90°
-- rot_q180 = quat(0,0,1,0) -- 180°
-- rot_q270 = quat(0,0,-√2/2,√2/2) -- 270°
-- Ray casting snaps meshes to terrain:
-- orig.z = orig.z - castRayStatic(orig, downVec, 1000) + 0.02Dependencies
| Module | Purpose |
|---|---|
editor/tech/roadArchitect/utilities | polyLerp, computeDivIndicesFromNode, findBounds |
See Also
- Road Architect - Clothoid - Related reference
- Road Architect - Decals - Related reference
- Road Architect - Export - Related reference
- World Editor Guide - Guide