RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Flowgraph Base ModuleFlowgraph Base NodeFlowgraph Base State NodeFlowgraph Node BuilderFlowgraph GraphFlowgraph Group HelperFlowgraph LinkFlowgraph ManagerNew Node TemplateFlowgraph PinFlowgraph States ManagerFlowgraph UtilsFlowgraph Variable Storage
Route Distance (Flowgraph Node)Closest Road (Flowgraph Node)Custom Lua (Flowgraph Node)Distance Between (Flowgraph Node)Waypoints Distance (Flowgraph Node)File Exists (Flowgraph Node)Get First Element of Table (Flowgraph Node)Get Level Data (Flowgraph Node)Get Map Objects IDs by DynField (Flowgraph Node)Get Table Value By Key (Flowgraph Node)GHOST (Flowgraph Node)Hide Loading Screen (Flowgraph Node)Color HSV (Flowgraph Node)Line Point From Xnorm (Flowgraph Node)Load Level (Flowgraph Node)Load Project (Flowgraph Node)On Menu (Flowgraph Node)Perlin Noise (Flowgraph Node)Pop Action Map (Flowgraph Node)Get Project InfoPush Action MapRandom ColorRandom NumberRandom QuaternionRandom VectorRoad PropertiesGet Navgraph RouteRoute PositionTemplate NodeTimeTimed SequenceTo NumberTo StringWorld Editor Open

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 Extensionsflowgraphnodesutil

Random Quaternion

- **Node Name:** `Random Quaternion`

Overview

  • Node Name: Random Quaternion
  • Category: repeat_instant
  • File: extensions/flowgraph/nodes/util/randomQuaternion.lua

Generates a random quaternion rotation by interpolating between min/max Euler angles on each axis. Outputs a new random rotation every frame.

Pin Schema

Input Pins

PinTypeDefaultDescription
xMinAnglenumber0Minimum angle for X axis, in degrees (hardcoded)
xMaxAnglenumber0Maximum angle for X axis, in degrees (hardcoded)
yMinAnglenumber0Minimum angle for Y axis, in degrees (hardcoded)
yMaxAnglenumber0Maximum angle for Y axis, in degrees (hardcoded)
zMinAnglenumber0Minimum angle for Z axis, in degrees (hardcoded)
zMaxAnglenumber360Maximum angle for Z axis, in degrees (hardcoded)

Output Pins

PinTypeDescription
quaternionquatThe random quaternion value (as table {x,y,z,w})

Internals

Key Methods

MethodDescription
work()Generates a random quaternion from per-axis Euler angle ranges each frame

Quaternion Construction

  1. For each axis, lerp interpolates between min and max radian values using math.random().
  2. Builds the quaternion by sequential multiplication: quatFromEuler(x,0,0) * quatFromEuler(0,y,0) * quatFromEuler(0,0,z).
  3. Outputs the result as a table via q:toTable().

How It Works

  1. Each frame, random angles are picked within the min/max range for X, Y, and Z.
  2. Angles are converted from degrees to radians using math.rad().
  3. Three axis-aligned quaternions are multiplied together to form the final rotation.
  4. Default setup (only Z: 0–360°) produces random yaw rotations with no pitch or roll.

Usage Example

-- Random yaw only (default):
-- zMinAngle = 0, zMaxAngle = 360
-- All other angles = 0
-- Output: random rotation around Z axis

-- Full random orientation:
-- xMinAngle = 0, xMaxAngle = 360
-- yMinAngle = 0, yMaxAngle = 360
-- zMinAngle = 0, zMaxAngle = 360

-- Limited tilt (±15° pitch, random yaw):
-- xMinAngle = -15, xMaxAngle = 15
-- yMinAngle = 0, yMaxAngle = 0
-- zMinAngle = 0, zMaxAngle = 360

Key Dependencies

  • quatFromEuler() - creates a quaternion from Euler angles
  • lerp() - linear interpolation helper

See Also

  • Route Distance (Flowgraph Node) - Related reference
  • Closest Road (Flowgraph Node) - Related reference
  • Custom Lua (Flowgraph Node) - Related reference
  • FlowGraph Guide - Guide

Random Number

- **Node Name:** `Random Number`

Random Vector

- **Node Name:** `Random Vector`

On this page

OverviewPin SchemaInput PinsOutput PinsInternalsKey MethodsQuaternion ConstructionHow It WorksUsage ExampleKey DependenciesSee Also