Theme:

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 string
  • type — Type string ('Object3D')
  • parent — Parent Object3D (or null)
  • children — Array of child Object3Ds
  • up — Up direction vector (default (0, 1, 0))
  • position — Local position (Vector3)
  • rotation — Local rotation as Euler (syncs with quaternion)
  • quaternion — Local rotation as Quaternion (syncs with rotation)
  • scale — Local scale (Vector3, default (1, 1, 1))
  • matrix — Local transform matrix (Matrix4)
  • matrixWorld — World transform matrix (Matrix4)
  • matrixAutoUpdate — Auto-compute local matrix each frame (default true)
  • matrixWorldAutoUpdate — Auto-compute world matrix (default true)
  • matrixWorldNeedsUpdate — Force world matrix update this frame
  • visible — Whether to render (default true)
  • castShadow, receiveShadow — Shadow flags (default false)
  • renderOrder — Override render sorting (default 0)
  • animations — Array of AnimationClips
  • userData — Custom data object

Static

  • Object3D.DEFAULT_UP — Default up vector (0, 1, 0)
  • Object3D.DEFAULT_MATRIX_AUTO_UPDATE — Default true
  • Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE — Default true

Methods

Transform

  • applyMatrix4(matrix) — Apply matrix, decompose into position/rotation/scale
  • applyQuaternion(q) — Apply rotation
  • setRotationFromAxisAngle(axis, angle), setRotationFromEuler(euler), setRotationFromMatrix(m), setRotationFromQuaternion(q)
  • rotateOnAxis(axis, angle) — Rotate in local space
  • rotateOnWorldAxis(axis, angle) — Rotate in world space
  • rotateX(angle), rotateY(angle), rotateZ(angle)
  • translateOnAxis(axis, distance) — Translate along local axis
  • translateX(d), translateY(d), translateZ(d)
  • lookAt(x, y, z) or lookAt(vector3) — Face a point in world space

Space Conversion

  • localToWorld(vector) — Local → world
  • worldToLocal(vector) — World → local

Hierarchy

  • add(object, ...) — Add child(ren)
  • remove(object, ...) — Remove child(ren)
  • removeFromParent() — Remove self from parent
  • clear() — Remove all children
  • attach(object) — Add child while preserving world transform

Search

  • getObjectById(id), getObjectByName(name)
  • getObjectByProperty(name, value) — First match
  • getObjectsByProperty(name, value, result?) — All matches

World State

  • getWorldPosition(target), getWorldQuaternion(target), getWorldScale(target), getWorldDirection(target)

Traversal

  • traverse(callback) — Visit all descendants
  • traverseVisible(callback) — Visit visible descendants only
  • traverseAncestors(callback) — Visit all ancestors

Matrix

  • updateMatrix() — Recompute local matrix from position/rotation/scale
  • updateMatrixWorld(force?) — Recompute world matrices for this and descendants
  • updateWorldMatrix(updateParents?, updateChildren?) — Selective update

Serialization

  • toJSON(meta?) — Serialize to JSON
  • clone(recursive?) — Deep copy
  • copy(source, recursive?) — Copy values from another Object3D

Events

  • added — Fired when added to a parent
  • removed — Fired when removed from a parent
  • childadded — Fired on parent when a child is added
  • childremoved — Fired on parent when a child is removed