API ReferenceGE Extensionsflowgraphnodestypes
Vec3 (Flowgraph Node)
- **Node Name:** `Vec3`
Overview
- Node Name:
Vec3 - Category:
repeat_instant - File:
extensions/flowgraph/nodes/types/vec3.lua
Constructs a 3D vector from x/y/z components, or converts a quaternion to a forward direction vector.
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
x | number | The x component |
y | number | The y component |
z | number | The z component |
rot | quat | (Hidden) Optional quaternion - if connected, outputs the rotated Y-forward direction |
Output Pins
| Pin | Type | Description |
|---|---|---|
value | vec3 | The vector3 value (as {x, y, z} table) |
How It Works
work():- If
rotis connected: rotates the Y-forward vector(0, 1, 0)by the quaternion and outputs the result. - Otherwise: outputs
{x, y, z}from the numeric inputs (defaulting to 0).
- If
drawMiddle()- Shows the vector string representation inline on the node.
Internals
- Uses module-level
tempQuat,vecOut, andvecYto avoid per-frame allocation. - Output is a plain table
{x, y, z}, not a vec3 userdata - standard flowgraph wire format.
Example Usage
-- Simple vector construction:
-- x=10, y=20, z=5 → output: {10, 20, 5}
-- Quaternion to forward direction:
-- Connect a quat to the 'rot' pin
-- Output: rotated (0,1,0) direction vector
-- Equivalent to:
local q = quat(rx, ry, rz, rw)
local forward = vec3(0, 1, 0):rotated(q)
self.pinOut.value.value = {forward.x, forward.y, forward.z}Additional Methods
C:_onDeserialized(nodeData)
Called after the node is deserialized (loaded from file). Restores runtime state from saved data.
Parameters:
nodeData
C:_onSerialize(res)
Called when the node is serialized (saved to file). Returns data to persist.
Parameters:
res
C:drawProperties()
Custom ImGui drawing function for the node editor.
See Also
- Bool (Flowgraph Node) - Related reference
- Color (Flowgraph Node) - Related reference
- Generic Set/Get Variable (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide