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 – Import

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

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


Module Info

KeyValue
Filelua/ge/extensions/editor/assemblySpline/import.lua
TypeRequired module (not an extension)
DependenciessplineMgr, molecule, rdp, fitPoly, geom, util

Constants

ConstantDefaultDescription
anchorPrefixStr"nail"Expected prefix for anchor point names
rdpLightTolerance0.5RDP simplification tolerance for light fitting

Public Functions

FunctionDescription
M.handleDelayedSplineUpdates()Called per-frame; waits for collision mesh updates before marking spline dirty
M.validateToolCompatibleTSStatic(obj)Validates if a TSStatic has tool-compatible anchor points (nail.* prefix)
M.convertTSStatics2AssemblySpline(collection)Converts selected TSStatic object IDs into an assembly spline with undo support
M.importFromPolygon(polygon)Finds all TSStatic objects inside a polygon and converts them to an assembly spline

Import Pipeline

  1. Backup: Saves all TSStatic objects' ID, name, position, rotation, scale, group before deletion
  2. Position extraction: Collects world positions from component objects
  3. Distance calculation: Computes inter-object distances for spacing
  4. RDP simplification: Reduces point density using Ramer-Douglas-Peucker algorithm
  5. Curve fitting: Uses fitPoly to generate smooth spline control points
  6. Orientation detection: Votes on component alignment using tangent/binormal analysis
  7. Spline creation: Creates a new assembly spline with imported nodes and width
  8. Delayed update: Waits 2 frames for collision mesh rebuild before final update

Backup/Restore (Undo)

-- Backup structure per TSStatic
{
  id = number,
  name = string,
  shapeName = string,
  pos = vec3,
  rot = string,        -- "x y z w" rotation field
  scale = vec3,
  groupId = number      -- parent SimGroup ID
}

-- Restore recreates TSStatic objects with original properties
-- (restoreTSStatics is an internal function, not exported)

Orientation Voting

The importer determines component orientation by:

  1. Computing tangent vectors along the spline
  2. Calculating expected vs actual binormal directions
  3. Voting across 4 rotation quadrants (0°, 90°, 180°, 270°)
  4. Applying the winning rotation offset to all placements

Usage Example

local import = require('editor/assemblySpline/import')

-- Import selected scene objects into a new spline
local components = getSelectedTSStatics()
local spline = splineMgr.createNewSpline()
local backup = import.importFromSceneObjects(components, spline)

-- Undo: restore original objects
import.undoImport(backup)

Functions

validateToolCompatibleTSStatic(obj)

Checks if a TSStatic object has tool-compatible anchor points (names starting with nail.).

  • obj (userdata) - A scene object to validate

Returns: boolean - true if the object is a TSStatic with at least one nail.* anchor point

convertTSStatics2AssemblySpline(collection)

Converts a collection of TSStatic object IDs into an assembly spline. Validates objects, reconstructs the assembly kit, fits a polyline, determines spacing/orientation, creates the spline, deletes originals, and commits to undo history.

  • collection (table) - Array of TSStatic object IDs

Returns: nil

importFromPolygon(polygon)

Finds all TSStatic objects whose positions fall inside the given polygon and converts them to an assembly spline via convertTSStatics2AssemblySpline.

  • polygon (table) - Array of vec3 points defining the selection polygon

Returns: nil


See Also

  • Assembly Spline - Main tool
  • Assembly Spline Distribution - Component distribution

Assembly Spline – Distribution

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

Assembly Spline Molecule

Handles mesh assembly kit parsing, attachment point extraction, and molecule building for the assembly spline tool. A "molecule" is a group of rigid meshes joined via attachment anchor points, with op

On this page

Module InfoConstantsPublic FunctionsImport PipelineBackup/Restore (Undo)Orientation VotingUsage ExampleFunctionsvalidateToolCompatibleTSStatic(obj)convertTSStatics2AssemblySpline(collection)importFromPolygon(polygon)See Also