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
Assembly Spline – DistributionAssembly Spline – ImportAssembly Spline MoleculeAssembly Spline PopulateAssembly Spline Manager

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 ExtensionseditorassemblySpline

Assembly Spline – Distribution

Generates mesh distribution patterns (random or round-robin) for assembly spline component placement, with probability weighting and variation support.

Generates mesh distribution patterns (random or round-robin) for assembly spline component placement, with probability weighting and variation support.


Module Info

KeyValue
Filelua/ge/extensions/editor/assemblySpline/distribution.lua
TypeRequired module (not an extension)
Dependencieseditor/assemblySpline/molecule

Public Functions

FunctionReturnsDescription
M.computeMeshMap(molecule, numPlacements, spline)rigidMaps, bridgeMapsComputes component distribution maps for all rigid and bridge components using random or round-robin patterns

Component Group Structure

componentGroup = {
  mesh = {
    id = "fence_post",
    meshPath = "/props/fence/post.dae",
    randomWeight = 1.0
  },
  randomWeight = 1.0,              -- base component weight
  variations = {
    { id = "fence_post_alt", meshPath = "/props/fence/post_alt.dae", randomWeight = 0.5 },
  }
}

Algorithm Details

Random Distribution

  1. Collects all enabled components (base + variations) using mol.getRigidEnabled / mol.getBridgeEnabled
  2. Normalises randomWeight values to sum to 1.0
  3. For each placement, samples a component using cumulative probability
  4. Returns array of mesh paths

Round-Robin Distribution

  1. Collects all enabled components
  2. Cycles through them sequentially for each placement
  3. Returns array of mesh paths

Internal State

Pre-allocated arrays are reused across calls for performance:

VariablePurpose
componentMeshDataParallel array of mesh data objects
componentProbabilitiesParallel array of normalised weights
resultArraysCached result arrays keyed by component ID

Usage Example

local dist = require('editor/assemblySpline/distribution')

-- Compute distribution maps for all rigid and bridge components
local rigidMaps, bridgeMaps = dist.computeMeshMap(molecule, numPlacements, mySpline)

Functions

computeMeshMap(molecule, numPlacements, spline)

Computes component distribution maps for all rigid and bridge components in the molecule. Uses random or round-robin distribution based on each component group's isRandom flag. Bridge maps have numPlacements - 1 entries (one per adjacent molecule pair).

  • molecule (table) - Molecule structure with rigids and bridges arrays
  • numPlacements (number) - Number of molecule placement positions along the spline
  • spline (table) - The assembly spline (used to check enabled states)

Returns: rigidMaps (table), bridgeMaps (table) - Indexed arrays of mesh path arrays per component group


See Also

  • Assembly Spline - Main tool
  • Assembly Spline Import - Scene import

Editor API – Dynamic Decals Textures

Manages the texture file library for the dynamic decals system, including sidecar metadata files, tag indexing, and file-change monitoring.

Assembly Spline – Import

Imports existing scene objects (TSStatic groups) into assembly splines by analyzing positions, fitting curves, and reconstructing spline data with undo support.

On this page

Module InfoPublic FunctionsComponent Group StructureAlgorithm DetailsRandom DistributionRound-Robin DistributionInternal StateUsage ExampleFunctionscomputeMeshMap(molecule, numPlacements, spline)See Also