API ReferenceGE Extensionsflowgraphnodesscenecamera
Set Camera Position (Flowgraph Node)
- **Node Name:** `Set Camera Position`
Overview
- Node Name:
Set Camera Position - Category:
repeat_instant - File:
extensions/flowgraph/nodes/scene/camera/setCameraPosition.lua
Sets the free camera's position in world space. Supports two modes: a hardcoded custom position or a dynamic position from an input pin. Preserves current camera rotation.
Pin Schema
Output Pins
| Pin | Type | Description |
|---|---|---|
value | vec3 | The position that was set |
Dynamic Input Pins (mode-dependent)
| Pin | Type | Description |
|---|---|---|
pos | vec3 | Position from pin (only in "from Pin" mode) |
Behavior
work()- Each frame:- Switches to free camera if needed.
- Reads position from the input pin (if mode is "from Pin") or uses the stored custom position.
- Calls
SetCamera()which usescore_camera.setPosRot()with the new position and the current rotation quaternion. - Outputs the applied position.
drawCustomProperties()- Editor UI with:- Mode dropdown:
customorfrom Pin - Position drag fields (in custom mode)
- "Set from camera" button to capture current camera position
- "Preview" button to apply the position
- Mode dropdown:
- Serialization - Saves/restores position and mode through
_onSerialize/_onDeserialized.
Internals
self.position-vec3storing the target positionself.mode-'custom'or'from Pin'SetCamera()- Applies position while preserving rotation viacore_camera.getQuat()
Key Dependencies
commands.isFreeCamera()/commands.setFreeCamera()- Free camera managementcore_camera.setPosRot(player, x, y, z, qx, qy, qz, qw)- Sets camera transformcore_camera.getQuat()- Gets current camera rotationcore_camera.getPosition()- Gets current camera position (for editor capture)
How It Works
The node offers flexibility through two modes. In custom mode, the position is hardcoded in the node's properties and editable in the flowgraph editor. In from Pin mode, it dynamically creates an input pin to receive position data from other nodes. Both modes preserve the existing camera rotation when updating position.
Example Usage
-- Static camera: use custom mode, set position in editor, wire into scene
-- Dynamic camera: use from Pin mode, wire a vec3 from scene objects
-- Combine with Set Camera Rotation for full camera controlAdditional Methods
C:drawMiddle(builder, style)
Custom ImGui drawing in the middle section of the node in the editor.
Parameters:
builderstyle
C:init()
Initializes the node, setting up pins and default properties.
See Also
- Camera Transform (Flowgraph Node) - Related reference
- Camera Look at Position (Flowgraph Node) - Related reference
- Camera Auto Circle (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide