API ReferenceGE Extensionsflowgraphnodesscene
Spawn Light / SpotLight (Flowgraph Node)
- **Node Name:** `SpotLight`
Overview
- Node Name:
SpotLight - Category:
repeat_instant - File:
extensions/flowgraph/nodes/scene/spawnLight.lua
Creates and manages a spotlight in the scene with configurable position, rotation, color, and beam properties.
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
update | flow | Updates spotlight position/properties when receiving flow |
clear | flow (impulse) | Clears the spotlight |
position | vec3 | Spotlight position |
rotation | quat | Spotlight rotation |
range | number | (Hidden) Light range (default 20) |
innerAngle | number | (Hidden) Inner cone angle (default 15) |
outerAngle | number | (Hidden) Outer cone angle (default 45) |
color | color | Light color |
brightness | number | (Hidden) Light brightness (default 1) |
Output Pins
| Pin | Type | Description |
|---|---|---|
created | flow (impulse) | Fires when the spotlight is created |
lastId | number | ID of the most recently created light |
Internals
| Field | Default | Purpose |
|---|---|---|
self.objects | {} | List of spawned SpotLight objects |
self.data.maxObjectCount | 1 | Maximum number of lights to create |
Behavior
work()- Each frame:- On
clear, deletes all lights. - If fewer lights than
maxObjectCount, creates a new one viacreateObject(). - If exactly 1 light and
updateflow is active, updates all properties in place.
- On
createObject()- UsesworldEditorCppApi.createObject("SpotLight")and sets position, rotation, angles, brightness, range, and color.clearObjects()- Deletes all spawned lights and clears the list.
How It Works
- On first trigger, creates a SpotLight via the world editor API (not
createObject()- usesworldEditorCppApi). - The light is configured with all input properties and flagged as
canSave = false. - When
updateflow is active with a single light, all properties are dynamically updated each frame. - Cleanup occurs on execution stop, mission end, or node destruction.
Key Dependencies
worldEditorCppApi.createObject("SpotLight")- creates the light objecteditor.onAddSceneTreeObjects()/onRemoveSceneTreeObjects()- editor integration
Additional Methods
C:_executionStopped()
Called when graph execution stops. Used for cleanup.
C:destroy()
Destroys the node and cleans up any created objects.
C:init(mgr, ...)
Initializes the node, setting up pins and default properties.
Parameters:
mgr...
C:onClientEndMission()
Cleanup callback when the mission/level ends.
See Also
- Collection Marker (Flowgraph Node) - Related reference
- Custom Lua Command (Flowgraph Node) - Related reference
- Get Object Field (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide