GCubeSDK
©2026 FenixFox®Studios

Camera

Camera ⟵ Object3D

Abstract base class for cameras.
This class inherits from Object3D and serves as the base for all camera types. It provides the fundamental camera functionality including projection matrices, world matrix inverses, and view direction calculations. Camera is essential for:

  • Defining the viewpoint and perspective of the scene
  • Managing projection and view matrices
  • Providing view frustum culling information
  • Serving as base class for specialized camera types (Perspective, Orthographic) Since Camera inherits from Object3D, it has all the same transformation and hierarchy capabilities, plus camera-specific functionality. Note: This class should always be inherited when building new camera types.

Methods

Camera()

Default constructor - creates a new camera

Camera(const string& name)

Constructor with custom name

name Human-readable name for the camera

Camera* clone(bool recursive = true) const override

Creates a copy of this camera

recursive Whether to clone all child objects as well

void copy(const Object3D& object, bool recursive = true) override

Copies properties from another object

object Source object to copy from
recursive Whether to copy all child objects as well

void updateProjectionMatrix()

Updates the projection matrix - pure virtual method

void update()

updates camera state each frame

Mtx* getViewMatrix() const

Gets the camera's view matrix

Mtx44* getProjectionMatrix() const

Gets the camera's projection matrix

void updateMatrixWorld(bool force = false)

Updates the world matrix and its inverse

force Force update even if not needed

Vector3 getWorldDirection(Vector3& target) const

Gets the world space direction the camera is looking

target Vector to store the result

void lookAt(f32 x, f32 y, f32 z)

Rotates the camera to face the specified world position

x Target X coordinate in world space
y Target Y coordinate in world space
z Target Z coordinate in world space

void lookAt(const Vector3& target)

Rotates the camera to face the specified world position

target Target position vector in world space

Properties

hasTarget bool Whether target is set
isCamera bool Read-only flag to check if object is Camera
matrixWorldInverse Mtx Inverse of the world matrix
orbitAngleH f32 Orbit radiance angle pan
orbitAngleV f32 Orbit radiance angle tilt
orbitControls bool Enable orbit controls
orbitRadius f32 Distance from camera to target
orbitSpeed f32 Rate of rotation change
orbitZoomSpeed f32 Rate of zoom change
projectionMatrix Mtx44 Projection matrix (4x4)
projectionMatrixInverse Mtx44 Inverse of projection matrix (4x4)
target Vector3 Target position to look at