Crawl Boundaries
Reference for `gameplay_crawl_boundary`, which manages spatial boundaries for rock crawling trails. Spawns animated flag markers along boundaries, checks crawler positions against boundary zones, and
Reference for gameplay_crawl_boundary, which manages spatial boundaries for rock crawling trails. Spawns animated flag markers along boundaries, checks crawler positions against boundary zones, and applies penalties/DNF for violations.
Overview
This extension handles three core responsibilities for crawl boundaries:
- Marker spawning - Places flag markers along boundary perimeters with proximity-based show/hide animations
- Boundary checking - Determines if crawler vehicle corners are inside the boundary zone
- Penalty enforcement - Tracks exit points and applies DNF if a crawler strays 10+ meters outside
Uses a quadtree for efficient proximity queries of boundary markers.
Exports
| Function | Signature | Description |
|---|---|---|
spawnBoundaryMarkers | (boundary, spacing) | Place flag markers along a boundary perimeter |
cleanupBoundaryMarkers | () | Remove all spawned markers and reset tracking |
checkBoundary | (site, crawler, crawlStates) | Check if a crawler is within bounds |
updateBoundaryAnimations | (dtSim) | Animate marker visibility based on player proximity |
resetBoundaryObjects | () | Reset all marker states |
setVisibilityRadius | (radius) | Set marker show/hide distance (default 100m) |
setAnimationTiming | (duration, fadeIn, fadeOut, scaleUp) | Configure animation durations |
rebuildQuadtree | () | Rebuild spatial index for markers |
getQuadtreeStats | () | Get debug stats about the quadtree |
triggerAppearingAnimation | () | Force all visible markers to re-animate |
clearCrawlerExitPoint | (crawlerId) | Clear exit tracking for a specific crawler |
clearAllExitPoints | () | Clear all exit tracking data |
Boundary Checking Logic
checkBoundary() evaluates all corners of the crawler vehicle:
- If all corners inside - crawler is within bounds, exit tracking is cleared
- If some corners outside - boundary violation penalty applied (with cooldown)
- If all corners outside AND 10+ meters from exit point - DNF penalty applied once
Exit points are tracked per crawler: the first position where the vehicle leaves the boundary is saved, and distance from that point determines DNF.
Marker Animation System
Markers use a proximity-based animation with four states:
"hidden"- Object is hidden, scale at minimum"appearing"- Fading in + scaling up overanimationDuration"visible"- Fully shown at max scale"disappearing"- Fading out overfadeOutDuration
Default animation timing:
| Parameter | Default |
|---|---|
animationDuration | 0.5s |
fadeInDuration | 0.3s |
fadeOutDuration | 0.2s |
scaleUpDuration | 0.4s |
visibilityRadius | 100m |
M.checkBoundary | (site, crawler, crawlStates) |
M.cleanupBoundaryMarkers | () |
M.clearAllExitPoints | () |
M.clearCrawlerExitPoint | (crawlerId) |
M.getQuadtreeStats | () |
M.rebuildQuadtree | () |
M.resetBoundaryObjects | () |
M.setAnimationTiming | (duration, fadeIn, fadeOut, scaleUp) |
M.setVisibilityRadius | (radius) |
M.spawnBoundaryMarkers | (boundary, spacing) |
M.triggerAppearingAnimation | () |
M.updateBoundaryAnimations | (dtSim) |
How It Works
-- Spawn markers along a boundary with 5m spacing
gameplay_crawl_boundary.spawnBoundaryMarkers(boundary, 5.0)
-- Per-frame animation update
gameplay_crawl_boundary.updateBoundaryAnimations(dtSim)
-- Check if crawler is in bounds
local inBounds = gameplay_crawl_boundary.checkBoundary(site, crawlerData, crawlStates)
-- Cleanup
gameplay_crawl_boundary.cleanupBoundaryMarkers()Key Behaviors
- Markers use
TSStaticobjects with the/art/shapes/race/flagMarker.daemesh - Markers are grouped under a
SimGroupnamed"BoundaryMarkers" - Terrain height and normal are used for proper marker placement
- Markers on steep terrain (normal dot < 0.5 with world up) are skipped
- Uses
smootherstepinterpolation for smooth animations instanceColoralpha channel controls visibility during animations
See Also
- crawl/crawlFlowgraphBridge - Crawl Flowgraph Bridge (Legacy) - Related reference
- crawl/debug - Crawl Debug Window - Related reference
- crawl/display - Crawl UI Messages - Related reference
- Gameplay Systems Guide - Guide
Crash Test Scenario Manager
Reference for `gameplay_crashTest_scenarioManager`, the main orchestrator for crash test missions. Manages multi-step crash test scenarios including vehicle setup, AI control, crash detection, scoring
Crawl Flowgraph Bridge
Reference for `gameplay_crawl_crawlFlowgraphBridge`, a bridge extension that exposes crawl system functionality to flowgraph nodes. This appears to be a legacy version - see also `gameplay_crawl_flowg