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)
InheritanceDiagram node_Audio Audio node_AudioEmitter AudioEmitter node_Audio->node_AudioEmitter node_AudioListener AudioListener node_AxesHelper AxesHelper node_Bone Bone node_BoneHelper BoneHelper node_Box3Helper Box3Helper node_BoxHelper BoxHelper node_Camera Camera node_PerspectiveCamera PerspectiveCamera node_Camera->node_PerspectiveCamera node_ClassName ClassName node_DirectionalLight DirectionalLight node_GridHelper GridHelper node_Group Group node_Light Light node_Light->node_DirectionalLight node_PointLight PointLight node_Light->node_PointLight node_Line Line node_Line->node_AxesHelper node_Line->node_Box3Helper node_Line->node_BoxHelper node_Line->node_GridHelper node_OctreeHelper OctreeHelper node_Line->node_OctreeHelper node_SphereHelper SphereHelper node_Line->node_SphereHelper node_Mesh Mesh node_SkinnedMesh SkinnedMesh node_Mesh->node_SkinnedMesh node_Object3D Object3D node_Object3D->node_Audio node_Object3D->node_AudioListener node_Object3D->node_Bone node_Object3D->node_BoneHelper node_Object3D->node_Camera node_Object3D->node_ClassName node_Object3D->node_Group node_Object3D->node_Light node_Object3D->node_Line node_Object3D->node_Mesh node_ParticleSystem ParticleSystem node_Object3D->node_ParticleSystem node_Points Points node_Object3D->node_Points node_Scene Scene node_Object3D->node_Scene node_SkeletonHelper SkeletonHelper node_Object3D->node_SkeletonHelper

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)

Updates the world transformation matrix if needed

force Force update even if not needed false

void updateWorldMatrix(bool updateParents, bool updateChildren)

Updates the world transformation matrix with optional parent/child updates

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

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) const

Creates a copy of this object

recursive Whether to clone descendants as well true

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

Copies properties from another object

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

Properties

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