Sidewalk Spline Populate
Handles the procedural placement of sidewalk meshes along splines - places rectangular pieces along the path with parallel-transport framing, fills gaps with triangular "pizza" pieces at turns, and ma
Handles the procedural placement of sidewalk meshes along splines - places rectangular pieces along the path with parallel-transport framing, fills gaps with triangular "pizza" pieces at turns, and manages mesh object pools.
Public API
| Function | Signature | Description |
|---|---|---|
M.populateSidewalkSpline | (spline, splineIdx) | Places all sidewalk meshes along a spline using rect + pizza pieces |
M.tryRemove | (spline) | Removes all static mesh objects for a given spline |
Placement Algorithm
Rect Placement
- Walk along the spline at fixed intervals (
rectLength = 2.5m) - At each step, evaluate position and frame using arc-length parameterization
- Apply parallel-transport framing for smooth roll continuity
- Align inner corners between consecutive rects for seamless joins
- Store frame data (forward, right, up) for pizza insertion pass
Pizza (Triangle) Placement
- After all rects are placed, iterate consecutive pairs
- Compute turn angle from forward vectors
- If angle ≥ 1° (
pizzaMinAngleDeg), insert a scaled triangle piece - Triangle base aligns with outer edge gap, scaled to fill the wedge
- Interior direction computed from inner corner midpoints
Mesh Dimensions
| Piece | Width (X) | Length (Y) |
|---|---|---|
Rect (square.dae) | 2.0m | 2.5m |
Pizza (triangle.dae) | 2.0m (scaled) | 2.5m (scaled) |
Mesh Pool Management
- Each spline maintains pools keyed by mesh path
- Pools grow on demand (create
TSStaticobjects) and shrink when excess - Meshes are placed into scene tree folders per spline
- All meshes use
cansave = truefor level persistence
Key Internal Functions
| Function | Purpose |
|---|---|
evalFrameAtArc(spline, s, pos, fwd, up) | Evaluates position and frame at arc length s using binary search on arcLengths |
manageMeshPools(spline, splineIdx, numPlacements) | Adds/removes TSStatic objects to match placement count |
getNextMeshFromPool(path, splineId) | Returns next available mesh from the pool for a given path |
Notes
- Maximum 2000 meshes per spline (
maxMeshesPerSpline) - Exit distance: stops 2m before end of spline
- Vertical offset applied uniformly to all placements
- Pizza pieces are non-uniformly scaled (X and Y independently) to fill wedge gaps
- Uses
vec3.setCross,setRotate,setRotationFromTofor efficient frame computation
See Also
- Sidewalk Spline Kit - Related reference
- Sidewalk Spline Manager - Related reference
- World Editor Guide - Guide
Sidewalk Spline Kit
Handles loading sidewalk mesh kits from folders - discovers meshes, extracts anchor points, groups base meshes with variations, and builds distribution groups for piece selection.
Sidewalk Spline Manager
Manages sidewalk spline data structures, including creation, removal, splitting, joining, undo/redo, profile copy/paste, and serialization. Works with `kit`, `populate`, and `geom` submodules.