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 Zone Bounds

Reference for `gameplay_drift_bounds`, which detects whether the drift vehicle is inside defined zone boundaries and optionally draws them.

Reference for gameplay_drift_bounds, which detects whether the drift vehicle is inside defined zone boundaries and optionally draws them.


Overview

Loads site zone data from a file, checks the player vehicle's position against zones each frame, and flags out-of-bounds state. The drift display system uses this to show "Out of bounds" warnings and the scoring system uses it to freeze point accumulation.


Exports

FunctionSignatureDescription
onUpdate()Detect out-of-bounds, draw zones, run debug
setBounds(filePath, drawBounds?)Load sites from file, enable/disable drawing
getIsOutOfBounds() → boolWhether vehicle is currently outside all zones
getDriftDebugInfo() → tableDebug toggle state
getGC() → numberGarbage collection from profiler

Internals

SymbolPurpose
sitesLoaded sites manager instance
isOutOfBoundsCurrent out-of-bounds flag
drawBoundsWhether to render zone debug visuals
profilerLuaProfiler for performance tracking
M.getDriftDebugInfo()
M.getGC()
M.getIsOutOfBounds()
M.onUpdate()
M.setBounds(filePath, drawBounds_)

How It Works

-- Set up bounds from a sites file (typically called by driftSpots or mission setup)
gameplay_drift_bounds.setBounds("/levels/west_coast_usa/driftSpots/spot1/bounds.sites.json", false)

-- Each frame, detectOutOfBounds() checks:
local zones = sites:getZonesForPosition(gameplay_drift_drift.getVehPos())
if #zones == 0 then
  isOutOfBounds = true  -- not inside any zone
end

-- Visual feedback: zones pulse red when out of bounds
-- Normal zones draw in white with filled interiors

Key Behaviors

  • Uses gameplay_sites_sitesManager.loadSites() to parse zone geometry
  • Zone drawing flashes red using sin(runtime*2) for visibility
  • Out-of-bounds state is consumed by gameplay_drift_general.checkFrozen() to freeze scoring
  • drawBounds defaults to true if not explicitly set to false in setBounds
  • Only checks if gameplay_drift_drift.getVehId() ~= -1

See Also

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

Heads-Up Drag Race

Reference for `gameplay_drag_dragTypes_headsUpDrag`, which implements a two-racer heads-up drag race with no handicap.

Drift Race Path

Reference for `gameplay_drift_destination`, which tracks remaining distance along a race path and detects wrong-way driving.

On this page

OverviewExportsInternalsHow It WorksKey BehaviorsSee Also