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
Generic Mission Data AppPoints Bar App
Minimap Additional InfoMinimap LayersMinimap (Main)Minimap RoadsMinimap RouteMinimap Topographic MapMinimap UtilitiesMinimap Vehicles

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 Extensionsuiappsminimap

Minimap Utilities

Coordinate transforms, drawing helpers, color sets, and boundary clamping for the minimap.

Coordinate transforms, drawing helpers, color sets, and boundary clamping for the minimap.


Overview

ui_apps_minimap_utils provides the core math (world-to-map transforms, boundary clamping) and drawing primitives (circles, lines, edge pointers) used by all minimap sub-modules.

Extension path: lua/ge/extensions/ui/apps/minimap/utils.lua


Exports (M)

State Management

FunctionSignatureDescription
setMinimapState(w, h, cx, cy, camPos, camRot, camRotInverse, scale, scaleInverse, td, ox, oy, mode, dpi)Called by main minimap each frame to sync state.

Coordinate Transforms

FunctionSignatureDescription
worldToMap(pos) → vec3Transforms a world vec3 to minimap pixel coords.
worldToMapXYZ(target, source)In-place transform: writes minimap coords into target from source. Zero-alloc.
worldToMapXY(x, y) → mapX, mapYScalar version - returns minimap coords from world x,y.
mapToWorld(pos) → vec3Inverse transform: minimap coords → world position.

Boundary Helpers

FunctionSignatureDescription
isInsideMinimapBounds(pos, buffer?) → boolTests if a minimap-space point is within bounds.
clampToMinimapBounds(pos, buffer?)Clamps a minimap-space point to bounds (mutates).
setClampToBounds(pos, inset?, maxDist?) → pos, wasClampedRay-based clamping to circle or rect boundary.

Drawing Helpers

FunctionSignatureDescription
simpleCircle(worldPos, fill?, stroke?, radius?)Draws a filled+stroked circle at a world position.
simpleLine(pos1, pos2, fill?, stroke?)Draws a stroked line between two world positions.
simpleCircleWithEdgePointer(worldPos, fill?, stroke?, radius?)Circle if on-screen, directional edge pointer if off-screen.
simpleLineWithEdgePointer(pos1, pos2, fill?, stroke?)Line if on-screen, edge pointer at midpoint if off-screen.
drawEdgePointer(worldPos, fill?, stroke?, radius?, maxDist?) → boolDraws a directional triangle+circle at the minimap edge. Returns true if clamped.
drawGrid()Draws a 50m-spaced grid overlay.
getDefaultStyleColorSet()Returns the default style color set for minimap rendering.

Data Fields

FieldDescription
M.centerPointerFunction that centers the map pointer/cursor.

Internals

Transform Math

The core transform applies offset, scale, and rotation in one pass:

local function worldToMapXY(x, y)
  x = (x - camPos.x) * scaleInverse
  y = (y - camPos.y) * scaleInverse
  local tX = x
  x = halfWidthWithOffset  + (tX * camFwd.x + y * camRight.x)
  y = halfHeightWithOffset - (tX * camFwd.y + y * camRight.y)
  return x, y
end

Boundary Clamping

setClampToBounds supports both modes:

  • Circle: Clamps to width/2 - inset radius from center
  • Rect: Ray-cast from center to target, intersecting against 4 rectangle edges using Cramer's rule

Color Palette

M.colors = {
  orange         = color(255,115,10,255),
  orangeMuted    = color(255*0.8,165*0.8,80,255),
  grayMuted      = color(100,100,100,255),
  roadBgTransparentBlack = color(50,50,50,255),
  navBgWhite     = color(255,255,255,255),
  navFgBlue      = color(0,102,255,255),
  gridWhite      = color(160,160,160,255),
}

Style Color Sets

Six predefined color themes (Default, Monochrome, Green, Blue, Orange, Grayscale) control road and UI element colors. Access via getStyleColorSet() and getCurrentStyleColors().


How It Works

  1. Main minimap calls setMinimapState() each frame with camera and canvas data
  2. All sub-modules use worldToMapXYZ / worldToMapXY for coordinate projection
  3. Drawing helpers handle world→map transform + primitive rendering in one call
  4. Edge pointers auto-detect off-screen positions and draw directional indicators at the boundary

Additional Exports

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

  • M.clampToMinimapBounds
  • M.dpi
  • M.drawEdgePointer
  • M.drawGrid
  • M.getCurrentStyleColors
  • M.getDefaultStyleColorSet
  • M.getStyleColorSet
  • M.isInsideMinimapBounds
  • M.mapToWorld
  • M.setClampToBounds
  • M.setMinimapState
  • M.simpleCircle
  • M.simpleCircleWithEdgePointer
  • M.simpleLine
  • M.simpleLineWithEdgePointer
  • M.worldToMap
  • M.worldToMapXY
  • M.worldToMapXYZ

Minimap Topographic Map

Generates and renders topographic contour lines from terrain heightmap data.

Minimap Vehicles

Renders player and other vehicles on the minimap with role-based styling.

On this page

OverviewExports (M)State ManagementCoordinate TransformsBoundary HelpersDrawing HelpersData FieldsInternalsTransform MathBoundary ClampingColor PaletteStyle Color SetsHow It WorksAdditional Exports