API ReferenceGE Extensionsflowgraphnodesscenecamera
Camera Look at Position (Flowgraph Node)
- **Node Name:** `Camera Look at Position`
Overview
- Node Name:
Camera Look at Position - Category:
repeat_instant - File:
extensions/flowgraph/nodes/scene/camera/cameraAutoRotate.lua - Icon: Camera icon
- Color: Camera color
Sets the camera rotation to always look at a given target position. The camera's position stays where it is; only the rotation updates.
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
position | vec3 | Target position to look at |
Output Pins
None.
Internals
- Uses a constant up vector
vec3(0, 0, 1). - Switches to free camera mode if not already active.
- Computes look-at quaternion via
quatFromDir(target - camPos, vecUp).
How It Works
- Every frame, ensures the camera is in free camera mode (
commands.setFreeCamera()). - Gets the current camera position via
core_camera.getPosition(). - Computes the direction from the camera to the target position.
- Sets the camera rotation to face that direction while maintaining the up vector.
Lua Code Example
-- Make the camera always look at a vehicle:
-- vehiclePosition → cameraAutoRotate.position
-- Camera stays in place but tracks the vehicle.
-- Or look at a static point of interest:
-- cameraAutoRotate.position = {100, 200, 50}Key Dependencies
core_camera-getPosition(),setPosRot()commands.isFreeCamera()/commands.setFreeCamera()- camera mode controlquatFromDir()- quaternion from direction vector
Additional Methods
C:work()
Main work function called each frame/tick when the node is active.
See Also
- Camera Transform (Flowgraph Node) - Related reference
- Camera Auto Circle (Flowgraph Node) - Related reference
- Simple Cam Path (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide