RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Editor AI TestsEditor AI VisualizationEditor – Assembly Spline ToolAsset BrowserAsset DeduplicatorAsset Management ToolSFX Previewer (Audio Events List)Audio Ribbon EditorAutoSaveBarriers EditorBiome ToolBuilding EditorBulk RenameCamera BookmarksCamera TransformCamera Path EditorCEF HelperCo-Simulation Signal EditorCrawl Data EditorCreate Object ToolDataBlock EditorDecal EditorDecal Spline EditorDocumentation HelperDrag Race EditorDrift Data EditorDrive Path EditorDynamic Decals Tool (Vehicle Livery Creator)Engine Audio DebugExtensions DebugExtensions EditorFFI Pointer Leak TestFile DialogFlowgraph EditorForest EditorForest ViewEditor Gizmo HelperEditor Ground Model Debug HelperEditor Headless Editor TestEditor Icon OverviewEditor ImGui C DemoEditor InspectorEditor Layout ManagerEditor Level SettingsEditor Level ValidatorEditor LoggerEditor Log HelperEditor MainEditor Main MenuEditor Main ToolbarEditor Main UpdateMap Sensor EditorMaster Spline EditorMaterial EditorMeasures Inspector HeaderMesh Editor (Base)Mesh Road EditorMesh Spline EditorMission EditorMission PlaybookMission Start Position EditorMulti Spawn Manager (Vehicle Groups)Navigation Mesh EditorEditor News MessageObject Tool (Object Select Edit Mode)Object To Spline EditorParticle EditorPerformance Profiler / Camera RecorderPhysics ReloaderPrefab Instance EditorEditor PreferencesRace / Path EditorRally EditorRaycast Test Editor ToolRenderer Components Editor ToolRender Test Editor ToolResource Checker Editor ToolRiver EditorRoad Architect EditorRoad DecorationsRoad Editor (Decal Road)Road Network ExporterRoad River Cache HandlerRoad River GUIRoad Spline EditorRoad Template EditorRoad UtilitiesScene TreeScene ViewScreenshot Creator BootstrapScript AI EditorScript AI ManagerSensor Configuration EditorSensor DebuggerShape EditorShortcut LegendSidewalk Spline EditorSites EditorSlot Traffic EditorSuspension Audio DebugTech Server ManagerTerraform ToolTerrain And Road ImporterTerrain EditorTerrain Materials EditorText EditorTool ManagerTool ShortcutsTraffic DebugTraffic ManagerTraffic Signals EditorUndo History ViewerVehicle Bridge TestVehicle Detail ViewerVehicle Editor MainEditor - VisualizationEditor Viz HelperEditor Water Object HelperEditor Windows Manager
Road Architect - ClothoidRoad Architect - DecalsRoad Architect - ExportRoad Architect - GeometryRoad Architect - GroupsRoad Architect - ImportRoad Architect - JunctionsRoad Architect - LinkRoad Architect - OverlaysRoad Architect - ProfilesRoad Architect - RenderRoad Architect - Road MeshRoad Architect RoadsRoad Architect - Static MeshRoad Architect - Static Mesh ManagerRoad Architect - TerraformRoad Architect - Tunnel MeshRoad Architect Utilities

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 ExtensionseditortechroadArchitect

Road Architect - Junctions

Manages road junctions (intersections) in the Road Architect. Handles junction creation from road endpoints/midpoints, topology computation, lane connection mapping, and junction road generation.

Manages road junctions (intersections) in the Road Architect. Handles junction creation from road endpoints/midpoints, topology computation, lane connection mapping, and junction road generation.


Public Functions

FunctionSignatureDescription
M.junctions``Junctions data table
M.addPedXJunction(...)Adds a pedestrian crossing junction
M.addCrossroads(...)Adds a crossroads junction
M.addTJunction(...)Adds a T-junction
M.addYJunction(...)Adds a Y-junction
M.addRoundaboutJunction(...)Adds a roundabout junction
M.addRuralUrbanTransJunction(...)Adds a rural-urban transition junction
M.addUrbanMergeJunction(...)Adds an urban merge junction
M.addUrbanSeparatorJunction(...)Adds an urban separator junction
M.addHighwayMergeJunction(...)Adds a highway merge junction
M.addHighwayUrbanTransJunction(...)Adds a highway-urban transition junction
M.addHighwaySeparatorJunction(...)Adds a highway separator junction
M.addShoulderFadeJunction(...)Adds a shoulder fade junction
M.addHighwaySlipJunction(...)Adds a highway slip junction
M.updateJunctionAfterChange(...)Updates junction after modification
M.removeJunction(...)Removes a junction
M.clearAllJunctions()Clears all junctions
M.getJunctionCentroid(...)Gets the centroid of a junction
M.computeInitRot(...)Computes initial rotation for junction
M.translateJunction(...)Translates a junction
M.rotateJunction(...)Rotates a junction
M.rotateJunctionQuat(...)Rotates a junction by quaternion
M.goToJunction(...)Navigates camera to a junction
M.setAllMeshProperty(...)Sets mesh property on all junction meshes
M.updateJunctionsAfterRoadRemove(...)Updates junctions after road removal
M.updateJunctionCondition(...)Updates junction condition data
M.finaliseJunction(...)Finalises a junction
M.copyJunction(...)Copies a junction
M.serialiseJct(...)Serializes a junction
M.deserialiseJct(...)Deserializes a junction
M.saveJunction(...)Saves a junction
M.loadJunction(...)Loads a junction
M.chopRoadsToSphere(...)Chops roads to a sphere region
M.createAutoJctOverlays(...)Creates automatic junction overlays
M.importRoadsFromLSystem(...)Imports roads from L-system

Example: Junction Workflow

local junctions = require('editor/tech/roadArchitect/junctions')

-- Find junction candidates near selected road endpoint
local candidates = junctions.getJunctionCandidates(roads, map, selRoadIdx, selNodeIdx)

-- Check candidate type
for _, c in ipairs(candidates) do
  if junctions.isEnd2End(c) then
    -- Two road endpoints meeting
  elseif junctions.isEnd2Mid(c) then
    -- One road endpoint meeting another's midpoint (T-junction)
  end
end

-- Create a junction from candidates
junctions.createJunction(roads, map, candidates)

-- After editing a connected road, update the junction
junctions.updateJunction(jIdx, allJunctions, roads, map)

-- Junction internals:
-- 1. Topology: maps which lanes connect across the intersection
-- 2. Junction roads: auto-generated short road segments connecting lanes
-- 3. These roads are marked isJctRoad = true (hidden in normal editing)

-- Remove a junction (also removes generated roads)
junctions.removeJunction(jIdx, allJunctions, roads, map)

Notes

  • Supports T-junctions (end-to-mid) and cross/Y junctions (end-to-end)
  • Junction roads are auto-generated with matching lane profiles
  • Lane connections computed from road heading and lane ordering

Functions

addPedXJunction(isNew)

Adds ped x junction.

  • isNew (any)

addCrossroads(isNew)

Adds crossroads.

  • isNew (any)

addTJunction(isNew)

Adds t junction.

  • isNew (any)

addYJunction(isNew)

Adds y junction.

  • isNew (any)

addRoundaboutJunction(isNew)

Adds roundabout junction.

  • isNew (any)

addRuralUrbanTransJunction(isNew)

Adds rural urban trans junction.

  • isNew (any)

addUrbanMergeJunction(isNew)

Adds urban merge junction.

  • isNew (any)

addUrbanSeparatorJunction(isNew)

Adds urban separator junction.

  • isNew (any)

addHighwayMergeJunction(isNew)

Adds highway merge junction.

  • isNew (any)

addHighwayUrbanTransJunction(isNew)

Adds highway urban trans junction.

  • isNew (any)

addHighwaySeparatorJunction(isNew)

Adds highway separator junction.

  • isNew (any)

addShoulderFadeJunction(isNew)

Adds shoulder fade junction.

  • isNew (any)

addHighwaySlipJunction(isNew)

Adds highway slip junction.

  • isNew (any)

updateJunctionAfterChange(jIdx)

Updates junction after change.

  • jIdx (any)

clearAllJunctions()

Clears all junctions.

getJunctionCentroid(jIdx)

Returns the junction centroid.

  • jIdx (any)

Returns: n1 + (n2 - n1) * 0.5

computeInitRot(jIdx)

Computes init rot.

  • jIdx (any)

Returns: util.getRotationBetweenVecs(xAxis, v1)

translateJunction(jIdx, offset)

Handles translate junction.

  • jIdx (any)
  • offset (vec3|number)

rotateJunction(jIdx, cen, theta)

Handles rotate junction.

  • jIdx (any)
  • cen (any)
  • theta (any)

rotateJunctionQuat(jIdx, cen, q)

Handles rotate junction quat.

  • jIdx (any)
  • cen (any)
  • q (any)

goToJunction(jIdx)

Handles go to junction.

  • jIdx (any)

setAllMeshProperty(jIdx)

Sets the all mesh property.

  • jIdx (any)

updateJunctionsAfterRoadRemove()

Updates junctions after road remove.

updateJunctionCondition(jct)

Updates junction condition.

  • jct (any)

finaliseJunction(jIdx)

Handles finalise junction.

  • jIdx (any)

copyJunction(jct)

Handles copy junction.

  • jct (any)

Returns: table

serialiseJct(jct)

Handles serialise jct.

  • jct (any)

Returns: table

deserialiseJct(jSer)

Handles deserialise jct.

  • jSer (any)

Returns: table

saveJunction(jIdx)

Saves junction.

  • jIdx (any)

loadJunction()

Loads junction.

chopRoadsToSphere(jNodes, jCen, jRad)

Handles chop roads to sphere.

  • jNodes (any)
  • jCen (any)
  • jRad (any)

createAutoJctOverlays(jNodes, laneWidth, jctCen)

Creates auto jct overlays.

  • jNodes (any)
  • laneWidth (any)
  • jctCen (any)

importRoadsFromLSystem(roadNetwork, intersections, DOI, margin, doTerraform)

Imports roads from l system.

  • roadNetwork (any)
  • intersections (any)
  • DOI (any)
  • margin (any)
  • doTerraform (any)

Returns: self

Functions

addPedXJunction(isNew)

Adds ped x junction.

  • isNew (any)

addCrossroads(isNew)

Adds crossroads.

  • isNew (any)

addTJunction(isNew)

Adds t junction.

  • isNew (any)

addYJunction(isNew)

Adds y junction.

  • isNew (any)

addRoundaboutJunction(isNew)

Adds roundabout junction.

  • isNew (any)

addRuralUrbanTransJunction(isNew)

Adds rural urban trans junction.

  • isNew (any)

addUrbanMergeJunction(isNew)

Adds urban merge junction.

  • isNew (any)

addUrbanSeparatorJunction(isNew)

Adds urban separator junction.

  • isNew (any)

addHighwayMergeJunction(isNew)

Adds highway merge junction.

  • isNew (any)

addHighwayUrbanTransJunction(isNew)

Adds highway urban trans junction.

  • isNew (any)

addHighwaySeparatorJunction(isNew)

Adds highway separator junction.

  • isNew (any)

addShoulderFadeJunction(isNew)

Adds shoulder fade junction.

  • isNew (any)

addHighwaySlipJunction(isNew)

Adds highway slip junction.

  • isNew (any)

updateJunctionAfterChange(jIdx)

Updates junction after change.

  • jIdx (any)

clearAllJunctions()

Clears all junctions.

getJunctionCentroid(jIdx)

Returns the junction centroid.

  • jIdx (any)

Returns: n1 + (n2 - n1) * 0.5

computeInitRot(jIdx)

Computes init rot.

  • jIdx (any)

Returns: util.getRotationBetweenVecs(xAxis, v1)

translateJunction(jIdx, offset)

Handles translate junction.

  • jIdx (any)
  • offset (vec3|number)

rotateJunction(jIdx, cen, theta)

Handles rotate junction.

  • jIdx (any)
  • cen (any)
  • theta (any)

rotateJunctionQuat(jIdx, cen, q)

Handles rotate junction quat.

  • jIdx (any)
  • cen (any)
  • q (any)

goToJunction(jIdx)

Handles go to junction.

  • jIdx (any)

setAllMeshProperty(jIdx)

Sets the all mesh property.

  • jIdx (any)

updateJunctionsAfterRoadRemove()

Updates junctions after road remove.

updateJunctionCondition(jct)

Updates junction condition.

  • jct (any)

finaliseJunction(jIdx)

Handles finalise junction.

  • jIdx (any)

copyJunction(jct)

Handles copy junction.

  • jct (any)

Returns: table

serialiseJct(jct)

Handles serialise jct.

  • jct (any)

Returns: table

deserialiseJct(jSer)

Handles deserialise jct.

  • jSer (any)

Returns: table

saveJunction(jIdx)

Saves junction.

  • jIdx (any)

loadJunction()

Loads junction.

chopRoadsToSphere(jNodes, jCen, jRad)

Handles chop roads to sphere.

  • jNodes (any)
  • jCen (any)
  • jRad (any)

createAutoJctOverlays(jNodes, laneWidth, jctCen)

Creates auto jct overlays.

  • jNodes (any)
  • laneWidth (any)
  • jctCen (any)

importRoadsFromLSystem(roadNetwork, intersections, DOI, margin, doTerraform)

Imports roads from l system.

  • roadNetwork (any)
  • intersections (any)
  • DOI (any)
  • margin (any)
  • doTerraform (any)

Returns: self


See Also

  • Road Architect - Clothoid - Related reference
  • Road Architect - Decals - Related reference
  • Road Architect - Export - Related reference
  • World Editor Guide - Guide

Road Architect - Import

Handles deserialization and import of Road Architect road data from JSON files. Reconstructs road structures (nodes, profiles, layers, groups, junctions) and initializes render state.

Road Architect - Link

Manages end-to-end road link operations in the Road Architect. Handles detection of linkable road endpoints, link creation (joining two roads), and link removal (splitting joined roads).

On this page

Public FunctionsExample: Junction WorkflowNotesFunctionsaddPedXJunction(isNew)addCrossroads(isNew)addTJunction(isNew)addYJunction(isNew)addRoundaboutJunction(isNew)addRuralUrbanTransJunction(isNew)addUrbanMergeJunction(isNew)addUrbanSeparatorJunction(isNew)addHighwayMergeJunction(isNew)addHighwayUrbanTransJunction(isNew)addHighwaySeparatorJunction(isNew)addShoulderFadeJunction(isNew)addHighwaySlipJunction(isNew)updateJunctionAfterChange(jIdx)clearAllJunctions()getJunctionCentroid(jIdx)computeInitRot(jIdx)translateJunction(jIdx, offset)rotateJunction(jIdx, cen, theta)rotateJunctionQuat(jIdx, cen, q)goToJunction(jIdx)setAllMeshProperty(jIdx)updateJunctionsAfterRoadRemove()updateJunctionCondition(jct)finaliseJunction(jIdx)copyJunction(jct)serialiseJct(jct)deserialiseJct(jSer)saveJunction(jIdx)loadJunction()chopRoadsToSphere(jNodes, jCen, jRad)createAutoJctOverlays(jNodes, laneWidth, jctCen)importRoadsFromLSystem(roadNetwork, intersections, DOI, margin, doTerraform)FunctionsaddPedXJunction(isNew)addCrossroads(isNew)addTJunction(isNew)addYJunction(isNew)addRoundaboutJunction(isNew)addRuralUrbanTransJunction(isNew)addUrbanMergeJunction(isNew)addUrbanSeparatorJunction(isNew)addHighwayMergeJunction(isNew)addHighwayUrbanTransJunction(isNew)addHighwaySeparatorJunction(isNew)addShoulderFadeJunction(isNew)addHighwaySlipJunction(isNew)updateJunctionAfterChange(jIdx)clearAllJunctions()getJunctionCentroid(jIdx)computeInitRot(jIdx)translateJunction(jIdx, offset)rotateJunction(jIdx, cen, theta)rotateJunctionQuat(jIdx, cen, q)goToJunction(jIdx)setAllMeshProperty(jIdx)updateJunctionsAfterRoadRemove()updateJunctionCondition(jct)finaliseJunction(jIdx)copyJunction(jct)serialiseJct(jct)deserialiseJct(jSer)saveJunction(jIdx)loadJunction()chopRoadsToSphere(jNodes, jCen, jRad)createAutoJctOverlays(jNodes, laneWidth, jctCen)importRoadsFromLSystem(roadNetwork, intersections, DOI, margin, doTerraform)See Also