API ReferenceGE Extensionsflowgraphnodesscene
Spawn TSStatic (Flowgraph Node)
- **Node Name:** `Spawn TSStatic`
Overview
- Node Name:
Spawn TSStatic - Category:
once_instant - File:
extensions/flowgraph/nodes/scene/spawnTSStatic.lua
Creates and manages spawning TSStatic (static mesh) objects in the scene.
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
flow | flow | Standard inflow |
reset | flow (impulse) | Clears all spawned objects |
shapeName | string | Shape file path (e.g., .dae or .dts) |
position | vec3 | Object position |
rotation | quat | Object rotation |
scale | vec3 | Object scale |
Output Pins
| Pin | Type | Description |
|---|---|---|
flow | flow | Standard outflow |
created | flow (impulse) | Fires when object is created |
lastId | number | ID of the most recently created object |
Internals
| Field | Default | Purpose |
|---|---|---|
self.objects | {} | List of spawned TSStatic objects |
self.data.maxObjectCount | 1 | Maximum objects to spawn |
Behavior
workOnce()- Creates the TSStatic object on first trigger.work()- Manages thecreatedimpulse flag (turns off after one frame).createObject()- Creates aTSStatic, sets shape/position/scale/rotation, flagscanSave = false, registers with a unique name, and adds to the objects list.onNodeReset()- Deletes all spawned objects and clears the list.
How It Works
- On first trigger,
workOnce()callscreateObject()to spawn a TSStatic with the given shape and transform. - The object is registered with a unique name (
spawnedObj_<timestamp>_<nodeId>_<index>). - The
createdimpulse pin fires for exactly one frame after creation. - All objects are cleaned up on execution stop, reset, mission end, or node destruction.
Example Usage
-- Spawn a barrier at a specific location:
-- shapeName = "art/shapes/objects/barrier_01.dae"
-- position = {100, 200, 50}
-- rotation = {0, 0, 0, 1}
-- scale = {1, 1, 1}Key Dependencies
createObject("TSStatic")- engine function for creating static mesh objectseditor.onAddSceneTreeObjects()/onRemoveSceneTreeObjects()- editor scene tree 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