GCubeSDK
©2026 FenixFox®Studios

Object3D

Base class for all 3D objects in the engine.
All other 3D objects inherit from this class. This is the foundation class that provides:

  • Basic identification (name, id, uuid)
  • Transform properties (position, rotation, scale)
  • Matrix calculations (model matrix, world matrix)
  • Scene graph hierarchy (parent, children)
  • Common properties (visible, enabled, matrixAutoUpdate)

Methods

Object3D()

Default constructor - creates an Object3D with default values

Object3D(const string& name)

Constructor with custom name

name Human-readable name for the object

void add(Object3D* child)

Adds a child object to this object's hierarchy

child Pointer to the child object to add

void remove(Object3D* child)

Removes a child object from this object's hierarchy

child Pointer to the child object to remove

void removeFromParent()

Removes this object from its current parent

void clear()

Removes all child objects from this object

Object3D* attach(Object3D* object)

Attaches an object while maintaining its world transform

object Pointer to the object to attach

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

Translates the object by the specified amounts

x Translation amount along X axis
y Translation amount along Y axis
z Translation amount along Z axis

void translate(const Vector3& offset)

Translates the object by the specified vector offset

offset Vector containing translation amounts

void translateX(f32 distance)

Translates the object along the X axis

distance Distance to translate along X axis

void translateY(f32 distance)

Translates the object along the Y axis

distance Distance to translate along Y axis

void translateZ(f32 distance)

Translates the object along the Z axis

distance Distance to translate along Z axis

void translateOnAxis(const Vector3& axis, f32 distance)

Translates the object along a specified axis in object space

axis Normalized axis vector to translate along
distance Distance to translate along the axis

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

Rotates the object by the specified Euler angles

x Rotation amount around X axis in radians
y Rotation amount around Y axis in radians
z Rotation amount around Z axis in radians

void rotate(const Vector3& rot)

Rotates the object by the specified rotation vector

rot Vector containing rotation amounts in radians

void rotateX(f32 rad)

Rotates the object around the X axis

rad Rotation amount in radians

void rotateY(f32 rad)

Rotates the object around the Y axis

rad Rotation amount in radians

void rotateZ(f32 rad)

Rotates the object around the Z axis

rad Rotation amount in radians

void rotateOnAxis(const Vector3& axis, f32 angle)

Rotates the object around a specified axis in object space

axis Normalized axis vector to rotate around
angle Rotation angle in radians

void rotateOnWorldAxis(const Vector3& axis, f32 angle)

Rotates the object around a specified axis in world space

axis Normalized axis vector in world space
angle Rotation angle in radians

void setRotationFromAxisAngle(const Vector3& axis, f32 angle)

Sets rotation from axis-angle representation

axis Normalized axis vector in object space
angle Rotation angle in radians

void setRotationFromEuler(const Euler& euler)

Sets rotation from Euler angles

euler Euler angles specifying rotation

void setRotationFromMatrix(const Mtx& m)

Sets rotation from rotation matrix

m 3x3 rotation matrix (upper part of 3x4)

void setRotationFromQuaternion(const Quaternion& q)

Sets rotation from quaternion

q Normalized quaternion

Quaternion getWorldQuaternion(Quaternion& target) const

Gets the object's rotation in world space as quaternion

target Quaternion to store the world rotation

Object3D& applyQuaternion(const Quaternion& quaternion)

Applies quaternion rotation to this object

quaternion Quaternion to apply

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

Scales the object by the specified factors

x Scale factor for X axis
y Scale factor for Y axis
z Scale factor for Z axis

void scale(const Vector3& scl)

Scales the object by the specified scale vector

scl Vector containing scale factors

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

Rotates the object 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 object to face the specified world position

target Target position vector in world space

void syncRotation()

Synchronizes quaternion from Euler rotation after direct modification

void updateMatrix()

Updates the local transformation matrix if needed

void updateMatrixWorld(bool force = false)

Updates the world transformation matrix if needed

force Force update even if not needed

void updateWorldMatrix(bool updateParents = true, bool updateChildren = true)

Updates the world transformation matrix with optional parent/child updates

updateParents Whether to update parent matrices
updateChildren Whether to update child matrices

void applyMatrix4(const Mtx& matrix)

Applies a 4x4 matrix transformation to this object

matrix Matrix to apply

Object3D* getObjectById(u32 id)

Searches for an object with the specified ID in the hierarchy

id Unique identifier to search for

Object3D* getObjectByName(const string& name)

Searches for an object with the specified name in the hierarchy

name Name to search for

Object3D* getObjectByProperty(const string& name, const void* value)

Searches for an object with a specific property value

name Property name to search for
value Property value to match

vector<Object3D*> getObjectsByProperty(const string& name, const void* value, vector<Object3D*>& result)

Searches for all objects with a specific property value

name Property name to search for
value Property value to match
result Vector to store matching objects

Vector3 getWorldPosition(Vector3& target) const

Gets the object's position in world space

target Vector to store the world position

Vector3 getWorldScale(Vector3& target) const

Gets the object's scale factors in world space

target Vector to store the world scale

Vector3 getWorldDirection(Vector3& target) const

Gets the object's forward direction in world space

target Vector to store the world direction

Vector3 localToWorld(const Vector3& vector) const

Converts a vector from local space to world space

vector Vector in local space

Vector3 worldToLocal(const Vector3& vector) const

Converts a vector from world space to local space

vector Vector in world space

void traverse(std::function<void(Object3D*)> callback)

Executes a callback function on this object and all descendants

callback Function to execute on each object

void traverseVisible(std::function<void(Object3D*)> callback)

Executes a callback function on visible objects only

callback Function to execute on each visible object

void traverseAncestors(std::function<void(Object3D*)> callback)

Executes a callback function on all ancestor objects

callback Function to execute on each ancestor

virtual Object3D* clone(bool recursive = true) const

Creates a copy of this object

recursive Whether to clone descendants as well

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

Copies properties from another object

object Source object to copy from
recursive Whether to copy descendants as well

Properties

animations vector<void*> Array with object's animation clips
castShadow bool Whether the object gets rendered into shadow map
children vector<Object3D*> Child objects
enabled bool Enabled/disabled flag
frustumCulled bool Frustum culling flag
id u32 Numeric identifier
isObject3D bool Read-only flag to check if object is Object3D
layers int Layer membership of the object
matrix Mtx& Local transform matrix (alias for modelMatrix)
matrixAutoUpdate bool Auto-update matrices every frame
matrixNeedsUpdate bool Flag to recalculate matrices
matrixWorld Mtx& Global transform matrix (alias for worldMatrix)
matrixWorldAutoUpdate bool Auto-update world matrices
matrixWorldNeedsUpdate bool Flag to recalculate world matrices
modelViewMatrix Mtx Passed to shader for position calculation
name string Human-readable name
normalMatrix Mtx Passed to shader for lighting calculation
parent Object3D* Parent object in scene graph
position Vector3 Position in 3D space
quaternion Quaternion* Object's local rotation as a Quaternion
receiveShadow bool Whether the material receives shadows
renderOrder int Rendering order override
rotation Vector3 Rotation (Euler angles in radians)
scaleFactors Vector3 Scale factors
up Vector3 Up direction for lookAt
userData void*
uuid string Unique identifier string
visible bool Visibility flag