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
Align For CouplingApply Velocity to VehicleBoost VehicleSet Vehicle ColorsCustom Parts Config ProviderEnter VehicleFlip UprightFreeze VehicleGenerate License PlateGet Vehicle ActiveGet Electrics ValueGet GearboxmodeGet Powertrain DataGravity ForceDistance From GroundHas Coupler TagIs CoupledIs Player UsableKeep VehicleMove Vehicle ToOn Cannon FiredOn Vehicle DestroyedOn Vehicle ResetOn Vehicle SpawnedOn Vehicle SwitchedPlayer UsableRandom Config ProviderRecover In PlaceRemove VehicleTimeline ReplaySet Vehicle ActiveSet Gearbox ModeSet IgnitionSet License PlateSet LightbarSet LightsShift to Gear IndexSpawn VehicleVehicle StatesTeleport To Last RoadToggle Vehicle ControlsMove To ShowroomVehicle TouchProps TouchStatic Object TouchTrack VehicleTrailer Respawn ControlVehicle Config ProviderGet Vehicle DataGet Vehicle DataGet Vehicle BoundsVehicle PingGet Vehicle Wheel Center

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 Extensionsflowgraphnodesvehicle

Gravity Force

- **Node Name:** `Gravity Force`

Overview

  • Node Name: Gravity Force
  • Category: repeat_p_duration
  • File: extensions/flowgraph/nodes/vehicle/gForce.lua

Gets the g-force (gravity force) values of a vehicle, split into lateral (X), longitudinal (Y), and vertical (Z) components, plus total magnitude.

Pin Schema

Input Pins

PinTypeDescription
vehIdnumberVehicle ID; if not provided, uses current player vehicle

Output Pins

PinTypeDescription
gxnumberLateral acceleration in g
gynumberLongitudinal acceleration in g
gznumberVertical acceleration in g (gravity-compensated)
gForcenumberTotal acceleration magnitude in g
gForceZ0number(hidden) Total acceleration ignoring vertical component

Internals

Key Methods

MethodDescription
init() / _executionStarted() / _executionStopped()Reset state via onNodeReset()
onNodeReset()Placeholder for unregistering cached values
work()Reads smoothed acceleration values from the vehicle bridge cache, normalizes by gravity, outputs g-force components

Cached Values

The node reads these from core_vehicleBridge.getCachedVehicleData:

KeyDescription
accXSmoothSmoothed lateral acceleration
accYSmoothSmoothed longitudinal acceleration
accZSmoothSmoothed vertical acceleration

How It Works

  1. Each frame, work() fetches the vehicle's smoothed acceleration values from the vehicle bridge cache.
  2. If a value isn't cached yet, it calls core_vehicleBridge.registerValueChangeNotification(veh, key) to start tracking it.
  3. The current gravity is fetched via core_environment.getGravity() (clamped to min 0.01 to avoid division by zero).
  4. G-force components are computed:
    • gx = accXSmooth / gravity (lateral)
    • gy = accYSmooth / gravity (longitudinal)
    • gz = (accZSmooth - gravity) / gravity (vertical, compensated for resting gravity)
  5. Total g-force: sqrt(gx² + gy² + gz²), and gForceZ0 ignores the Z component.

Usage Example

-- In a flowgraph:
-- [Gravity Force] → gForce → [Compare > 2.0] → [Trigger Blackout Effect]
--                 → gx     → [Display Lateral G]

-- Programmatic equivalent:
local accX = core_vehicleBridge.getCachedVehicleData(vehId, 'accXSmooth') or 0
local gravity = math.abs(core_environment.getGravity())
local gx = accX / gravity

Key Dependencies

  • core_vehicleBridge.getCachedVehicleData() - reads cached vehicle telemetry
  • core_vehicleBridge.registerValueChangeNotification() - subscribes to vehicle data updates
  • core_environment.getGravity() - returns current world gravity value

See Also

  • Align for Coupling (Flowgraph Node) - Related reference
  • Apply Velocity to Vehicle (Flowgraph Node) - Related reference
  • Boost Vehicle (Flowgraph Node) - Related reference
  • FlowGraph Guide - Guide

Get Powertrain Data

- **Node Name:** `Get Powertrain Data`

Distance From Ground

- **Node Name:** `Distance From Ground`

On this page

OverviewPin SchemaInput PinsOutput PinsInternalsKey MethodsCached ValuesHow It WorksUsage ExampleKey DependenciesSee Also