API ReferenceGE Extensionsflowgraphnodesenvironment
Planet
- **File:** `extensions/flowgraph/nodes/environment/planet.lua`
Overview
- File:
extensions/flowgraph/nodes/environment/planet.lua - Name:
Planet - Category:
once_p_duration - Description: Creates a planet with custom gravity and optional heightmap-based terrain mesh for a vehicle.
Pin Schema
Input Pins
| Name | Type | Description |
|---|---|---|
vehId | number | ID of the vehicle that will have modified gravity. Falls back to player vehicle. |
position | vec3 | Position to spawn the planet. |
heightmap | string | Path to a PNG heightmap file for the planet surface. |
surfaceHeight | number | Surface height multiplier for the planet terrain. |
radius | number | Radius of the planet. |
mass | number | Mass of the planet. |
Output Pins
None.
Behavior
- workOnce(): Validates inputs (position, radius ≥ 1, mass required). Sends
obj:setPlanets()command to the vehicle with position, radius, and mass. Then generates a 3D spherical terrain mesh from the heightmap PNG using cube-to-sphere projection, placing six ProceduralMesh faces (up/down/front/back/left/right). - _executionStopped() / onNodeReset(): Clears planets from the vehicle and deletes all generated ProceduralMesh objects.
Terrain Generation
- Loads a PNG heightmap via
GBitmap. - Interprets RGB as height values.
- Maps six cube faces onto a sphere using
warpSphereCubic(). - Creates ProceduralMesh objects with computed vertices, normals, UVs, and faces.
- Uses
procheightmapMatmaterial (dirt texture).
Legacy Pin Mapping
vehID→vehId
Node Display
- Shows debug sphere at planet position, gravity force, and distance to vehicle when
showDebugis enabled. - Displays computed surface gravity value.
Tags
#flowgraph #node #ge #environment #planet #gravity #terrain
Additional Exports
init()
drawMiddle(builder, style)
- builder -
any - style -
any
createheightmapMesh(heightmap, uvScale, material)
- heightmap -
any - uvScale -
any - material -
any - Returns:
any
normalFromPoints(p1, p3, p2)
- p1 -
any - p3 -
any - p2 -
any - Returns:
any
placeObject(name, mesh, pos, rot)
- name -
any - mesh -
any - pos -
any - rot -
any - Returns:
any
heightmapFromPNG(path, scale, invertColors)
- path -
any - scale -
any - invertColors -
any - Returns:
any
getSquare(grid, size, identifier, dimensions)
-
grid -
any -
size -
any -
identifier -
any -
dimensions -
any -
name-string- (see source) -
color-any- (see source) -
icon-any- (see source) -
description-string- (see source) -
category-string- (see source) -
todo-string- (see source) -
pinSchema-table- (see source) -
legacyPins-table- (see source) -
tags-table- (see source) -
gConst-any- (see source)
See Also
- Directional Gravity - Related reference
- Get Cloud by ID - Related reference
- Get Fog - Related reference
- FlowGraph Guide - Guide