RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

cdefDebugDraw ReferencecdefGpuMesh ReferencecdefImgui ReferencecdefMath Referencecdefs ReferencecontrolSystems Referencecsvlib ReferencedelayLine Referencedequeue ReferencedevUtils ReferenceEvent Referenceextensions Referencefilters Referencegraphpath Referenceguihooks ReferenceinputFilters ReferenceinterpolatedMap Referenceintrospection ReferencejbeamWriter Referencejson-ast Referencejson ReferencejsonDebug ReferencejsonPrettyEncoderCustom Referencekdtreebox2d Referencekdtreebox3d Referencekdtreepoint3d Referencelpack ReferenceluaBinding ReferenceluaCore ReferenceluaProfiler Referencemathlib Referenceparticles Referencequadtree Referencesettings ReferencetcpServer ReferencetimeEvents Referenceutils Reference

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 Referencecommon

particles Reference

Module defined in `lua/common/particles.lua`. Manages particle material data and lookup tables for collision-based particle effects (e.g., tire smoke, sparks, debris).

Module defined in lua/common/particles.lua. Manages particle material data and lookup tables for collision-based particle effects (e.g., tire smoke, sparks, debris).


Exports

Functions

M.getMaterialByID(mats, i)

Retrieves a material definition by its index.

  • Parameters:
    • mats - table - Materials array
    • i - number|nil - Material index
  • Returns: table - Material data for the given ID

M.getMaterialIDByName(mats, s)

Finds a material index by name; returns a safe fallback if not found.

  • Parameters:
    • mats - table - Materials array
    • s - string - Material name
  • Returns: number - Material index (falls back to min(3, #mats) if not found)

M.getOrAddMaterialIDByName(mats, s)

Finds a material index by name, creating a temporary definition if not found.

  • Parameters:
    • mats - table - Materials array
    • s - string - Material name
  • Returns: number - Material index (newly created if not found)

M.getMaterialsParticlesTable()

Returns the full materials and material-pair-to-particles mapping tables.

  • Returns: table, table - materials array and materialsMap lookup table

Internal Notes

  • Materials and particle definitions are loaded from lua/common/particles.json at require time
  • The materialsMap key is materialID1 * 10000 + materialID2 with IDs sorted so the larger is first
  • Each particle definition has dynamically compiled comparison functions from expressions like "X > 5" where X is replaced with the actual field value
  • Comparison fields: perpendicularVel, slipVel - expressions evaluate against runtime collision data
  • Material definitions include: name, colorR, colorG, colorB, dynamic flag

mathlib Reference

Module defined in `lua/common/mathlib.lua`. Core math library providing `vec3` and `quat` types with operator overloading, plus extensive geometry utilities (ray intersections, OBB tests, splines, etc

quadtree Reference

Module defined in `lua/common/quadtree.lua`. Quadtree spatial data structure for 2D bounding boxes with insert, remove, query, and compression. Query is remove-safe (removing items during iteration do

On this page

ExportsFunctionsM.getMaterialByID(mats, i)M.getMaterialIDByName(mats, s)M.getOrAddMaterialIDByName(mats, s)M.getMaterialsParticlesTable()Internal Notes