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
Sites Custom FieldsSites LocationSites Parking SpotSites ContainerSites ManagerSites Zone

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 Extensionsgameplaysites

Sites Location

Class representing a named point location within the sites system. Has a position, radius, color, and custom fields. Used for marking points of interest within zones.

Class representing a named point location within the sites system. Has a position, radius, color, and custom fields. Used for marking points of interest within zones.


Constructor

local Location = require('gameplay/sites/location')
local loc = Location(sites, name, forceId)
ParameterTypeDescription
sitesobjectParent sites container (provides getNextUniqueIdentifier)
namestring?Display name (defaults to "Location N")
forceIdnumber?Override auto-generated ID

Methods

MethodSignatureReturnsDescription
set(pos, radius)nilSet position and radius
drawDebug(drawMode, clr)nilDraw sphere + name label + closest road info
findClosestRoadInfo()table?Find nearest road segment from map graph
onSerialize()tableSerialize to JSON
onDeserialized(data)nilRestore from JSON data

Fields

FieldTypeDefaultDescription
posvec3(0,0,0)World position
radiusnumber5Interaction radius
colorvec3(1,1,1)Display color (RGB floats)
customFieldsCustomFieldsnewCustom typed fields and tags
_drawModestring"faded"Drawing mode: faded, normal, highlight, none

How It Works

  1. Location is a sphere in 3D space with a name label
  2. Debug drawing adapts to drawMode - highlight mode also shows the closest road segment
  3. findClosestRoadInfo() uses map.findClosestRoad to locate the nearest graph edge, then projects the location onto that edge
local loc = Location(parentSites, "Gas Station")
loc:set(vec3(100, 200, 50), 10)

-- Find closest road
local road = loc:findClosestRoadInfo()
if road then
  print(road.name_a, road.name_b, road.distance)
  print("Projected pos:", road.pos)
end

Dependencies

  • gameplay/sites/customFields - custom field system
  • map - findClosestRoad, getMap().nodes
  • core_camera - distance culling
  • editor - draw distance preference

Notes

  • Draw distance respects editor preference gizmos.visualization.visualizationDrawDistance (default 300)
  • The xnormOnLine projection for closest road is clamped to [0, 1] and swapped if closer to second point
FunctionSignatureReturnsDescription
M.init(sites, name, forceId)nilinit

See Also

  • Sites Custom Fields - Related reference
  • Sites Parking Spot - Related reference
  • Sites Container - Related reference
  • Gameplay Systems Guide - Guide

Sites Custom Fields

Class for managing typed custom fields and tags on sites objects (locations, zones, parking spots). Supports `string`, `number`, and `vec3` field types plus a tag set.

Sites Parking Spot

Class representing an oriented 3D parking box. Supports multi-spot generation (rows of spots), vehicle parking validation, and safe vehicle teleportation.

On this page

ConstructorMethodsFieldsHow It WorksDependenciesNotesSee Also