Object3D
Base class for most scene objects. Provides transform hierarchy, visibility, and serialization.
Extends EventDispatcher.
Constructor
const obj = new Object3D();
Properties
id— Auto-incrementing integer ID (readonly)uuid— UUID string (readonly)name— Optional name stringparent— Parent Object3D (ornull)children— Array of child Object3Dsposition— Local position (Vector3)rotation— Local rotation as Euler (syncs withquaternion)quaternion— Local rotation as Quaternion (syncs withrotation)scale— Local scale (Vector3, default(1, 1, 1))matrix— Local transform matrix (Matrix4)matrixWorld— World transform matrix (Matrix4)visible— Whether to render (defaulttrue)castShadow— Whether this object's renderable geometry casts shadows (defaulttrue); this is per object and is not inherited by childrenanimations— Array of AnimationClipsuserData— Custom data object
Methods
Transform
applyMatrix4(matrix)— Apply matrix, decompose into position/rotation/scaleapplyQuaternion(q)— Apply rotationsetRotationFromAxisAngle(axis, angle),setRotationFromEuler(euler),setRotationFromMatrix(m),setRotationFromQuaternion(q)rotateOnAxis(axis, angle)— Rotate in local spacerotateOnWorldAxis(axis, angle)— Rotate in world spacerotateX(angle),rotateY(angle),rotateZ(angle)translateOnAxis(axis, distance)— Translate along local axistranslateX(d),translateY(d),translateZ(d)lookAt(x, y, z)orlookAt(vector3)— Face a point in world space
Space Conversion
localToWorld(vector)— Local → worldworldToLocal(vector)— World → local
Hierarchy
add(object, ...)— Add child(ren)remove(object, ...)— Remove child(ren)removeFromParent()— Remove self from parentclear()— Remove all childrenattach(object)— Add child while preserving world transform
Search
getObjectById(id),getObjectByName(name)getObjectByProperty(name, value)— First matchgetObjectsByProperty(name, value, result?)— All matches
World State
getWorldPosition(target),getWorldQuaternion(target),getWorldScale(target),getWorldDirection(target)sync()— Queue transform and descendant render updatessetVisible(boolean)— Change visibility through Unia's scene-update path
Traversal
traverse(callback)— Visit all descendants
Matrix
updateMatrix()— Recompute local matrix from position/rotation/scaleupdateMatrixWorld(force?)— Recompute world matrices for this and descendantsupdateWorldMatrix(updateParents?, updateChildren?)— Selective update
After gameplay transform changes, call sync(). Matrix-update methods can
recompute CPU matrices immediately, but they do not notify Unia's renderer or
replace sync().
After changing castShadow, call sync() so the shadow renderer receives the
new per-object value.
Unia's add() synchronizes a newly parented child and queues its subtree for
rendering. Also call world.add(child) only when a late-added subtree has
update/preUpdate callbacks or point/spot lights. Raycasting remains explicit
through world.addRaycastable(mesh).
remove() and removeFromParent() only change the hierarchy. Use
world.remove(object) to dispose a runtime subtree.
Serialization
toJSON(meta?)— Serialize to JSONclone(recursive?)— Deep copy; always await the result because cloning can be asynchronouscopy(source, recursive?)— Copy values; the result may be asynchronous in Unia