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
| Name | Type | Description |
|---|---|---|
vehId | number | ID of target vehicle. Falls back to player vehicle if not set. |
direction | vec3 | Direction of gravity. Normalized internally. Default: {0,0,-1}. Hardcoded. |
magnitude | number | Gravity 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² / Gso 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
showDebugis 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