Crash Test Boundaries
Reference for `gameplay_crashTest_crashTestBoundaries`, which manages spatial boundaries for crash test missions. Checks whether the player vehicle is inside designated zones and triggers out-of-bound
Reference for gameplay_crashTest_crashTestBoundaries, which manages spatial boundaries for crash test missions. Checks whether the player vehicle is inside designated zones and triggers out-of-bounds events.
Overview
This extension loads boundary zones from .sites.json files and performs per-frame checks to determine if the player vehicle remains within the allowed area. When out of bounds, it notifies the scenario manager and draws visual boundary indicators.
Exports
| Function | Signature | Description |
|---|---|---|
onUpdate | () | Per-frame check: tests player position, draws bounds if enabled |
setParameters | (params) | Load boundary zones from a sites file |
setDebug | (debug) | Enable/disable debug mode |
onNewCrashTestStep | (stepData) | Load step-specific or default boundary file |
deactivateBounds | () | Clear active boundary zones |
M.deactivateBounds | () | - |
M.onNewCrashTestStep | (stepData) | - |
M.onUpdate | () | - |
M.setDebug | (debug) | - |
M.setParameters | (params) | - |
Internals
- sites - Loaded via
gameplay_sites_sitesManager.loadSites(), contains zone definitions - isPlayerOutOfBounds - Boolean flag updated each frame
- drawBoundsWhenNear - When true, draws boundary zone outlines near the player
Boundary Loading
setParameters({filePath = "..."}) loads a sites file and finalizes the zones. Passing nil filePath clears the boundaries.
Each crash test step can have its own boundary file (boundsStep<id>.sites.json) or fall back to the default bounds.sites.json.
Out-of-Bounds Detection
Each frame, the extension checks the player vehicle's spawn OOBB points against all loaded zones. If any OOBB point falls outside all zones, the player is marked as out of bounds and gameplay_crashTest_scenarioManager.onPlayerOutOfBounds() is called.
How It Works
- When a crash test step begins,
onNewCrashTestStep(stepData)loads the appropriate boundary file onUpdate()runs every frame - checks player OOBB against zones- If out of bounds, the scenario manager is notified (typically fails the step)
- Zone outlines are drawn with a flashing red/white color based on boundary status
-- Load boundaries from a sites file
gameplay_crashTest_crashTestBoundaries.setParameters({
filePath = "/missions/crashTest/bounds.sites.json"
})
-- Clear boundaries
gameplay_crashTest_crashTestBoundaries.deactivateBounds()Key Behaviors
- Boundary zones flash red when the player is out of bounds, white when inside
- The
drawBoundsWhenNearflag defaults totrueif not specified in parameters - Step-specific boundary files use the naming convention
boundsStep<stepId>.sites.json - The mission-relative path is resolved via the foreground mission's manager
See Also
- crashTestCountdown - Crash Test Countdown Timer - Related reference
- crashTestScoring - Crash Test Score Calculation - Related reference
- crashTestTaskList - Crash Test UI Task List - Related reference
- Gameplay Systems Guide - Guide
G2G Activity
Background activity that spawns random vehicles into the world. Uses a step-based sequence with fade-to-black transitions for vehicle spawning.
Crash Test Countdown
Reference for `gameplay_crashTest_crashTestCountdown`, a simple countdown timer that displays a visual countdown and plays audio cues before a crash test step begins.