RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Gameplay AchievementGameplay CityDiscoverForce FieldGarage ModeMarker InteractionParking SystemGameplay Playmode MarkersGameplay PoliceGameplay RallyGameplay Rally LoopGameplay Raw POIsGameplay Skidpad TestSpeed Trap LeaderboardsSpeed Traps and CamerasGameplay StatisticsTaxi Ride SystemTraffic SystemVehicle PerformanceWalking
Drift Zone BoundsDrift Race PathDrift UI DisplayDrift Detection EngineDrift SystemDrift Quick MessagesDrift Save/LoadDrift ScoreboardDrift Scoring SystemDrift AudioDrift StallingDrift StatisticsDrift Stunt Zones

UI

Resources

BeamNG Game Engine Lua Cheat SheetGE Developer RecipesMCP Server Setup

// RLS.STUDIOS=true

Premium Mods for BeamNG.drive. Career systems, custom vehicles, and immersive gameplay experiences.

Index

HomeProjectsPatreon

Socials

DiscordPatreon (RLS)Patreon (Vehicles)

© 2026 RLS Studios. All rights reserved.

Modding since 2024

API ReferenceGE Extensionsgameplaydrift

Drift Stunt Zones

Reference for `gameplay_drift_stuntZones`, which manages the lifecycle, detection, rendering, and scoring of drift stunt zones (donuts, drift-throughs, hit poles, near poles).

Reference for gameplay_drift_stuntZones, which manages the lifecycle, detection, rendering, and scoring of drift stunt zones (donuts, drift-throughs, hit poles, near poles).


Dependencies

gameplay_drift_general


Overview

Central manager for all stunt zone objects. Handles spawning zones from data, per-frame detection of player interactions, cooldown management, decal rendering, and forwarding accomplishments to the scoring/stalling systems.


Exports

FunctionSignatureDescription
onUpdate(dtReal, dtSim, dtRaw)Per-frame: detection, cooldowns, debug UI
onExtensionUnloaded()Clears all stunt zones
onDriftStatusChanged(isDrifting)Resets donut angle tracking when drift ends
onDriftDebugChanged()Resets draw lines toggle
onVehicleDestroyed(vehId)Forwards to each stunt zone's onVehicleDestroyed
onSerialize()Clears all zones on serialize
onAnyStuntZoneAccomplished(data)Forwards to stalling system and fires data.subHookName hook
clear()Removes and cleans up all stunt zones
reset()Resets all stunt zones to initial state
setStuntZones(zones)Creates stunt zones from data array (clears existing first)
getStuntZones()Returns the stunt zones table
increaseDecalPool(max)Expands the decal pool to max entries
getDecalColor(cooldownPerc, filledPerc, t)Returns color based on cooldown/fill state
getLineThickness(linePos)Returns thickness based on distance to camera
getGreenColor()Returns green ColorF
getWhiteColor()Returns white ColorF
getRedColor()Returns red ColorF
getDriftDebugInfo()Returns {default=true, canBeChanged=true}
getDrawLines()Returns whether debug lines should be drawn
clearStuntZone(id)Removes a specific stunt zone by id
M.clear()-
M.clearStuntZone(id)-
M.dependenciesvalue-
M.getDecalColor(cooldownPerc, filledPerc, t)-
M.getDrawLines()-
M.getDriftDebugInfo()-
M.getGreenColor()-
M.getLineThickness(linePos)-
M.getRedColor()-
M.getStuntZones()-
M.getWhiteColor()-
M.increaseDecalPool(max)-
M.onAnyStuntZoneAccomplished(data)-
M.onDriftDebugChanged()-
M.onDriftStatusChanged(isDrifting)-
M.onExtensionUnloaded()-
M.onSerialize()-
M.onUpdate(dtReal, dtSim, dtRaw)-
M.onVehicleDestroyed(vehId)-
M.reset()-
M.setStuntZones(zones)-

Zone Data Format (input to setStuntZones)

{
  type = "donut"|"driftThrough"|"hitPole"|"nearPole",
  pos = vec3(...),
  cooldown = number,        -- seconds (donut/driftThrough)
  scl = number|vec3(...),   -- radius (donut) or dimensions (driftThrough)
  rot = quat(...),          -- orientation (driftThrough only)
  score = number,           -- optional, defaults from scoring options
}

Key Behaviors

  • Each zone type is loaded via require("gameplay/drift/stuntZones/"..type) as a class factory
  • Near-zone detection triggers onNearStuntZoneFirst hook once per zone type for help messages
  • Stunt detection only runs while the player is actively drifting
  • Cooldown management prevents re-scoring the same zone too quickly
  • Debug imgui panel allows spawning/removing zones and benchmarking performance

See Also

  • drift/bounds - Drift Zone Boundary Detection - Related reference
  • drift/destination - Race Path & Wrong-Way Detection - Related reference
  • drift/display - Drift UI & HUD Management - Related reference
  • Gameplay Systems Guide - Guide

Drift Statistics

Reference for `gameplay_drift_statistics`, which records drift performance metrics into the persistent statistics system (`gameplay_statistic`).

Freeroam Cruising

Reference for `gameplay_drift_freeroam_cruising`, which automatically shows/hides the drift angle UI when the player sustains a drift chain while in freeroam.

On this page

DependenciesOverviewExportsZone Data Format (input to setStuntZones)Key BehaviorsSee Also