RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

server/commands - Camera & Input Commandsge_utils - Game Engine Utility Functionsmain.lua - GE Lua Entry Point & Game Loopmap.lua - Navigation Graph (AI Road Map)screenshot.lua - Screenshot Systemserver/server - Level Loading & Game ServerserverConnection - Client-Server Connection Manager`setSpawnpoint` - Default Spawn Point Persistence`simTimeAuthority` - Simulation Time & Bullet Time Control`spawn` - Vehicle Spawning & Safe Placement`suspensionFrequencyTester` - Suspension Natural Frequency Analysis
ui/ambientSound - Ambient Sound Stream PlayerUI Apps ManagerUI AudioBindings LegendCamera Distance AppConsole (consoleNG)Credits MusicExternal App (WebSocket UI Server)Fade ScreenGame BlurGameplay App ContainersGrid SelectorLivery EditorMessages DebuggerMessages/Tasks App ContainersMission InfoPolice InfoTop BarUI ModsUI Navigation / MapVehicle Paint EditorVehicle Vicinity AppUI Visibility
Livery Editor - CameraLivery Editor - ControlsLivery Editor - Edit ModeLivery Editor – Editor (Core)Livery Editor – HistoryLivery Editor – Layer ActionLivery Editor – Layer EditLivery Editor – LayersLivery Editor – ResourcesLivery Editor – SelectionLivery Editor – ToolsLivery Editor – User DataLivery Editor – Utils

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 ExtensionsuiliveryEditor

Livery Editor – Utils

Math and conversion utilities shared across the livery editor modules.

Math and conversion utilities shared across the livery editor modules.


Overview

ui_liveryEditor_utils provides common math helpers used throughout the livery editor - angle conversions, rounding, coordinate extraction, range cycling, and action map resolution.

Extension path: lua/ge/extensions/ui/liveryEditor/utils.lua


Exports (M)

FunctionSignatureDescription
convertRadiansToDegrees(radians) → numberConverts radians to degrees.
convertDegreesToRadians(degrees) → numberConverts degrees to radians with 14-decimal precision.
getBaseDegreesValue(value) → numberNormalises a degree value to 0–360 range.
roundAndTruncateDecimal(number, decimals) → numberRounds to the specified decimal places (default 1).
getXYCoordinates(decalPos, coordinates) → {x, y}Extracts X/Y from a decal position based on camera coordinate mapping.
cycleRange(value, min, max) → numberWraps a value within [min, max) using modulo.
getActionMapNameByTool(tool) → stringMaps a tool constant to its action map name.

Internals

Angle Conversion

local convertRadiansToDegrees = function(radians)
  return radians * (180 / math.pi)
end

local convertDegreesToRadians = function(degrees)
  local radians = degrees * (math.pi / 180)
  return tonumber(string.format("%.14f", radians))
end

The radians-to-degrees conversion preserves full precision. Degrees-to-radians truncates to 14 decimal places to avoid floating-point drift.

Rounding

local roundAndTruncateDecimal = function(number, decimals)
  decimals = decimals or 1
  local scale = 10 ^ decimals
  return math.ceil(number * scale - 0.5) / scale
end

Uses ceiling-minus-half for symmetric rounding (round-half-up behaviour).

Cycle Range

local cycleRange = function(value, min, max)
  value = value % max
  if value < min then
    value = value + max
  end
  return value
end

Used for wrapping rotation degrees: cycleRange(370, 0, 360) → 10.

Coordinate Extraction

getXYCoordinates reads from a decalPos vector using camera-defined axis indices, allowing the same code to work regardless of camera orientation.


How It Works

  1. Transform modules call convertRadiansToDegrees / convertDegreesToRadians for UI display
  2. roundAndTruncateDecimal keeps displayed values clean (e.g., 0.001 precision for position)
  3. cycleRange ensures rotation values stay within 0–360
  4. getActionMapNameByTool resolves tool names to action map identifiers for input binding

Example Usage

local utils = extensions.ui_liveryEditor_utils

-- Convert rotation for display
local degrees = utils.convertRadiansToDegrees(1.5708)  -- ~90.0

-- Round for UI
local rounded = utils.roundAndTruncateDecimal(0.12345, 2)  -- 0.12

-- Wrap rotation
local wrapped = utils.cycleRange(-10, 0, 360)  -- 350

Additional Exports

The following exports are available but not yet documented in detail:

  • M.convertDegreesToRadians
  • M.convertRadiansToDegrees
  • M.cycleRange
  • M.getActionMapNameByTool
  • M.getBaseDegreesValue
  • M.getXYCoordinates
  • M.roundAndTruncateDecimal

Livery Editor – User Data

Manages livery save files - listing, creating, renaming, and deleting `.dynDecals.json` files.

Livery Editor – Layers / Cursor

Manages the decal placement cursor - position, scale, skew, rotation, colour, material properties, and mirror settings.

On this page

OverviewExports (M)InternalsAngle ConversionRoundingCycle RangeCoordinate ExtractionHow It WorksExample UsageAdditional Exports