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
Directional GravityGet Cloud by IDGet FogGet GravityGet PauseGet PhotomodeGet ScatterSkyGet Time of DayPause GamePlanetRandom Time of DayBullet TimeSet Cloud by ID NodeSet Fog NodeSet Gravity NodeSet ScatterSky NodeSet Time of Day NodeSet Wind NodeSimple Planet 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 Extensionsflowgraphnodesenvironment

Directional Gravity

- **File:** `extensions/flowgraph/nodes/environment/directionalGravity.lua`

Overview

  • File: extensions/flowgraph/nodes/environment/directionalGravity.lua
  • Name: Directional Gravity
  • Category: dynamic_p_duration
  • Description: Sets directional gravity for a vehicle by simulating a distant, massive planet in the specified direction.

Pin Schema

Input Pins

NameTypeDescription
vehIdnumberID of target vehicle. Falls back to player vehicle if not set.
directionvec3Direction of gravity. Normalized internally. Default: {0,0,-1}. Hardcoded.
magnitudenumberGravity strength in m/s². Default: 1. Hardcoded.

Output Pins

None.

Behavior

  • workOnce(): Computes and applies directional gravity via a virtual planet.
  • work(): Re-applies gravity each frame if dynamicMode == 'repeat'.
  • _executionStopped(): Clears all planets from the vehicle (obj:setPlanets({})).
  • setDirectionalGravity(): Places a virtual planet (radius 1,000,000m) in the normalized direction from the vehicle. Calculates mass from magnitude * r² / G so surface gravity matches the desired magnitude.

Physics Model

Uses Newton's gravitational constant G = 6.6742e-11 to derive planet mass from desired surface gravity magnitude. The planet is placed at extreme distance so gravity is effectively uniform and directional.

Legacy Pin Mapping

  • vehID → vehId

Node Display

  • When showDebug is enabled, draws a debug line showing gravity direction and displays the computed force value.

Tags

#flowgraph #node #ge #environment #gravity #vehicle


Additional Exports

init()

drawMiddle(builder, style)

  • builder - any

  • style - any

  • name - string - (see source)

  • color - any - (see source)

  • icon - any - (see source)

  • description - string - (see source)

  • category - string - (see source)

  • pinSchema - table - (see source)

  • legacyPins - table - (see source)

  • tags - table - (see source)

  • gConst - any - (see source)


See Also

  • Get Cloud by ID - Related reference
  • Get Fog - Related reference
  • Get Gravity - Related reference
  • FlowGraph Guide - Guide

Category Test (Test Dynamic)

- **File:** `extensions/flowgraph/nodes/debug/testDynamic.lua`

Get Cloud by ID

- **File:** `extensions/flowgraph/nodes/environment/getCloud.lua`

On this page

OverviewPin SchemaInput PinsOutput PinsBehaviorPhysics ModelLegacy Pin MappingNode DisplayTagsAdditional Exportsinit()drawMiddle(builder, style)See Also