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
Accumulator (Flowgraph Node)Ease (Flowgraph Node)Increaser (Flowgraph Node)Expression (Flowgraph Node)
Direction (Flowgraph Node)Look At (Flowgraph Node)

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 Extensionsflowgraphnodesmathquaternion

Direction (Flowgraph Node)

- **Node Name:** `Direction`

Overview

  • Node Name: Direction
  • Category: simple
  • File: extensions/flowgraph/nodes/math/quaternion/direction.lua

Converts an angle in degrees into a quaternion representing rotation around the Z axis (clockwise).

Pin Schema

Input Pins

PinTypeDescription
degnumberInput angle in degrees

Output Pins

PinTypeDescription
valuequatQuaternion describing the Z-axis rotation

Internals

FieldPurpose
self.oldInCached last input to avoid redundant recalculation
rot (local)Reusable quat object for performance

How It Works

  1. The node takes a degree value and converts it to radians: (deg / 180) * π.
  2. A quaternion is set from Euler angles (0, 0, radians) - rotation around Z only.
  3. The result is cached: the quaternion is only recalculated when the input changes.
  4. Output is the quaternion as a table via rot:toTable().

Lua Example

-- Input: deg = 90
-- Output: quaternion representing 90° clockwise rotation around Z
-- Equivalent to: quat():setFromEuler(0, 0, math.pi/2)

-- Use case: Orient a vehicle or camera to face a compass direction
-- 0° = forward, 90° = right, 180° = backward, 270° = left

Key Dependencies

  • quat / setFromEuler - quaternion math primitives
  • _flowgraph_createNode() - standard flowgraph node registration

Additional Methods

C:init()

Initializes the node, setting up pins and default properties.

C:work()

Main work function called each frame/tick when the node is active.


See Also

  • Look At (Flowgraph Node) - Related reference
  • FlowGraph Guide - Guide

Expression (Flowgraph Node)

- **Node Name:** `Expression`

Look At (Flowgraph Node)

- **Node Name:** `Look At`

On this page

OverviewPin SchemaInput PinsOutput PinsInternalsHow It WorksLua ExampleKey DependenciesAdditional MethodsC:init()C:work()See Also