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
Gen Decal EditorGen Experimental Frame EditorGen Mesh ExplorerGen Experimental SolidFlexGen Mesh ModuleGen Network ModuleGen Region ModuleGen Render ModuleGen Terrain ModuleEditor Gen TestEditor Gen Top (Roof Geometry)Editor Gen UI (Building Architect UI)Editor Gen UtilsEditor Gen World

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 Extensionseditorgen

Gen Mesh Module

Core 3D mesh creation, manipulation, and DAE export module for the gen editor.

Core 3D mesh creation, manipulation, and DAE export module for the gen editor.


Overview

The mesh module provides low-level 3D mesh operations: vertex/face/UV construction, DAE (Collada) export, material creation, mesh positioning via matrix transforms, and graph/set/text output buffers. It is the foundational geometry module used by all gen editor tools. At 6800+ lines, this is one of the largest modules in the gen editor.


Module Table: M

FieldTypeDescription

Exported Functions

Scene Placement & Transforms

FunctionSignatureDescription
M.to(daedesc, pos, vang, scale)Places a DAE mesh at position/angle/scale via MatrixF transform. Returns scene item.
M.fillSegment(a, b, daedesc, turn, dbg)Fills segment between two points with repeated DAE mesh placements
M.space(am, sam, dir, val, L, daedata)Spaces meshes along a direction

Mesh Construction

FunctionSignatureDescription
M.log(av, af, auv)Creates a test box mesh (8 verts, 24 faces). Returns av, af, auv, an
M.rc(u, v, av, af, pos, withback)Creates a rectangle from u/v vectors
M.rect(u, v, av, af, pos, hasfront)Creates a rectangle with optional front face
M.tri(a, b, c, av, af, auv, ref, orig)Creates a triangle from 3 points
M.zip(aiv, af, withback, withnorm, withuv)Zips vertex strips into mesh faces
M.zip2(base, ai, an, auv, af, uvscale, uvflip, dbg)Extended zip with UV/normal control
M.forBeam(base, L, uvflip, mat, w)Creates beam geometry from base points
M.tri2mdata(av, ai, istart, dnorm, an, auv, af, iuvini, uvscale)Converts triangle data to mesh data format
M.flipSide(af, an)Flips face winding and normals
M.meshUp(data, nm, group)Creates a ProceduralMesh from mesh data
M.joint(a, b, dbg)Creates joint geometry between two elements
M.forJoint(fbag, m)Processes joint data for a mesh

Grid & Plate Operations

FunctionSignatureDescription
M.fromGrid(u, v, ax, ay, skip, av, af, X, Y, uvstart)Creates mesh from grid coordinates
M.grid2mesh(u, v, ax, ay, uext, vext, av, af, auv, skip)Converts grid to mesh with UV mapping
M.grid2plate(u, v, ax, ay, askip, av, af, auv, an, uvx, uvy)Converts grid to plate mesh with normals
M.forPlate(m)Processes plate mesh data
M.forBags(m)Processes bag mesh data

UV Operations

FunctionSignatureDescription
M.uvTransform(auv, shift, scale)Transforms UV coordinates by shift and scale
M.uv4poly(base, istart, auv, dbg)Computes UVs for a polygon from 3D positions
M.uv4grid(uvx, uvy, ax, ay, X, Y, auv)Computes UVs for grid vertices
M.forUV(base, istart, uvini, w, scale, auv)Computes UVs for a base shape

Paving & Splines

FunctionSignatureDescription
M.rcPave(base, aloop, mrc, dbg)Paves rectangles along loops (primary)
M.rcPave_(rc, aloop, mrc, apatch, istest)Paves rectangles (variant with patches)
M.rcPave__(ae, aloop, mrc)Paves rectangles (variant with edges)
M.framePave(aloop, dir, astep)Creates frame paving along loops
M.frameSpline(base, ahole, ap, adist, astep)Creates frame along spline with holes

DAE / XML / File Operations

FunctionSignatureDescription
M.daeFrom(p)Parses DAE file, returns mesh data
M.daeParse(fname)Parses DAE file by filename
M.toDAE(am, pth)Exports mesh array to DAE file
M.toXML(m, ndmesh)Converts mesh to XML node
M.xmlOn(fname)Opens/parses XML file
M.xml2file(xml, fname)Writes XML document to file
M.dae2proc(fname, showlist, step)Converts DAE to ProceduralMesh
M.save(ageom, fname)Saves geometry array to file

XML Node Tree Traversal

FunctionSignatureDescription
M.forNode(node, path, lvl, ind, dbg)Traverses XML node tree recursively
M.ofChild(prn, path, obj)Gets child node by path
M.forChild(nd, name, cb)Iterates children matching name, calls callback
M.text2node(nd, txt)Sets text content of XML node
M.toNode(nd, name, obj)Creates/finds XML child node
M.ofNode(nd, obj)Gets node data as object

GPU / Geometry Data

FunctionSignatureDescription
M.d2buf(ad, map)Converts data array to buffer using field map
M.toSource(ndsrc, s, count, stride)Reads source data from XML node
M.toGeo(m, xml, id, ndgeo)Processes geometry node into mesh data
M.gpuFrom(id)Extracts GPU mesh data by object ID
M.toLOD(desc, fname, arc, T)Creates LOD (Level of Detail) variant
M.forLOD(template, dist, geosrc)Processes LOD template

Vehicle Mesh

FunctionSignatureDescription
M.forBeams(aobeam, anode)Creates beam geometry from vehicle beam/node data
M.vehFrom(data)Extracts mesh data from vehicle data
M.toGhost(am)Creates ghost (transparent) version of meshes
M.geoFrom(nd, dmat)Extracts geometry from DAE node with material

Material Operations

FunctionSignatureDescription
M.matUp(nm, c)Creates/registers material with color. Returns material name
M.matReplace(fname, mat)Replaces material in a DAE file
M.matSet(fname, mat, aind, xml)Sets material on specific geometry indices
M.forAMat(fname)Extracts material array from DAE file
M.colorOn(mat, c)Sets color on existing material

Mesh Edit Operations

FunctionSignatureDescription
M.pop(fr, to)Pops/extrudes mesh faces between two states
M.move(list, fr, to, mat, mode)Moves mesh elements
M.copy(list, fr, to, mat)Copies mesh elements
M.cut(list, fr, to, mat)Cuts mesh elements
M.clone(tmesh)Deep clones a mesh
M.update(tmesh)Updates procedural mesh in scene
M.mark(mdata, out)Marks mesh data for selection/highlight
M.step(base, ind)Steps through base array by index

Hit Testing & Validation

FunctionSignatureDescription
M.ifHit(adata, pfr, pto, forall)Ray-mesh hit test
M.faceHit(am)Face-level hit detection
M.dissect(pos, dir, mdata)Dissects mesh at position along direction
M.valid(am)Validates mesh data integrity

Alignment & Lifecycle

FunctionSignatureDescription
M.align(m, pfr, pto, space)Aligns mesh between two points (stub)
M.onUpdate()Per-frame update hook

Internal (Not Exported)

These local functions are used internally but not exposed on M:

  • reload() - Hot-reloads utils and render deps (called once at load)
  • forNorm(a, b, c, vn) - Computes face normal key
  • xml2mesh(node, lvl) - Recursive XML-to-mesh converter
  • toKids(node, ageom) - Processes child nodes into geometry
  • vec2buf(v, av) - Writes vec3 to buffer array
  • kidsList(node, lvl, prop, aind, val, dbg) - Lists XML children by property
  • zip2_(aiv, av, af) - Internal zip variant
  • zip_(base, av, af, auv, ref, orig) - Internal zip variant
  • pop___, pop__, pop_ - Internal pop/extrude variants

Mesh Data Format

Vertices (av)

Array of vec3 positions.

Faces (af)

Array of face entries: {v = vertexIndex, n = normalIndex, u = uvIndex}

UVs (auv)

Array of UV entries: {u = float, v = float}

Normals (an)

Array of vec3 normal directions.


Dependencies

ModulePath
Utils/lua/ge/extensions/editor/gen/utils
Render/lua/ge/extensions/editor/gen/render

Usage Example

local M = require('/lua/ge/extensions/editor/gen/mesh')

-- Place a DAE mesh in the scene
local desc = {fo = myFileObject}
M.to(desc, vec3(100, 200, 50), vec3(0, 0, math.pi/4), 1.5)

-- Create a test box mesh
local verts, faces, uvs, normals = M.log({}, {}, {})

-- Create a grey material
local matName = M.matUp(1, {0.6, 0.6, 0.6})

-- Fill a segment with repeated meshes
M.fillSegment(vec3(0,0,0), vec3(100,0,0), desc, 0)

-- Export meshes to DAE
M.toDAE(meshArray, '/path/to/output')

-- Parse a DAE file
local meshData = M.daeFrom('/path/to/model.dae')

-- Validate mesh
local ok = M.valid(meshArray)

See Also

  • Gen Render - Debug drawing utilities
  • Gen Mesh Explorer - Interactive mesh inspection
  • Gen JBeam Library - Vehicle beam data

Gen Experimental SolidFlex

Experimental solid/flex body simulation editor for exploring deformation and physics properties.

Gen Network Module

Road network generation and geometric utility module with socket-based communication.

On this page

OverviewModule Table: MExported FunctionsScene Placement & TransformsMesh ConstructionGrid & Plate OperationsUV OperationsPaving & SplinesDAE / XML / File OperationsXML Node Tree TraversalGPU / Geometry DataVehicle MeshMaterial OperationsMesh Edit OperationsHit Testing & ValidationAlignment & LifecycleInternal (Not Exported)Mesh Data FormatVertices (av)Faces (af)UVs (auv)Normals (an)DependenciesUsage ExampleSee Also