API Signatures Reference (Three.js Scene Graph r160+)
Object3D
The base class for all 3D objects. Every Mesh, Group, Light, Camera, and Scene inherits from Object3D.
Constructor
new Object3D()No parameters. Creates an object at origin with identity transform.
Transform Properties
position: Vector3 // default: (0, 0, 0) -- local position
rotation: Euler // default: (0, 0, 0, 'XYZ') -- linked to quaternion
quaternion: Quaternion // default: (0, 0, 0, 1) -- linked to rotation
scale: Vector3 // default: (1, 1, 1) -- local scale
up: Vector3 // default: (0, 1, 0) -- up direction for lookAt()Hierarchy Properties
parent: Object3D | null // set automatically by add()/remove()
children: Object3D[] // NEVER modify directlyRendering Properties
visible: boolean // default: true
castShadow: boolean // default: false
receiveShadow: boolean // default: false
frustumCulled: boolean // default: true
renderOrder: number // default: 0
layers: Layers // default: layer 0 enabledIdentity Properties
uuid: string // read-only, auto-generated RFC 4122 v4
id: number // read-only, auto-incrementing integer
name: string // default: ""
type: string // read-only, e.g., "Object3D", "Mesh"
userData: object // default: {}Matrix Properties
matrix: Matrix4 // local transform matrix
matrixWorld: Matrix4 // world transform matrix
matrixAutoUpdate: boolean // default: true
matrixWorldAutoUpdate: boolean // default: true
matrixWorldNeedsUpdate: boolean // default: false
modelViewMatrix: Matrix4 // computed per frame by renderer
normalMatrix: Matrix3 // computed per frame by rendererHierarchy Methods
add(object: Object3D, ...args: Object3D[]): thisAdds one or more children. Auto-removes from previous parent. Fires added event on child. Returns this for chaining.
remove(object: Object3D, ...args: Object3D[]): thisRemoves one or more children. Fires removed event. NEVER throws if object is not a child. Returns this.
removeFromParent(): thisRemoves this object from its parent. Safe when parent is null. Returns this.
clear(): thisRemoves ALL children. ALWAYS prefer over manual iteration to avoid index-shifting bugs. Returns this.
attach(object: Object3D): thisAdds object as child while preserving its world transform. Internally recomputes local transform from world transform. Returns this.
Traversal Methods
traverse(callback: (object: Object3D) => void): voidDepth-first traversal of this object and ALL descendants. Performance: O(n).
traverseVisible(callback: (object: Object3D) => void): voidSame as traverse() but skips objects where visible === false and all their descendants.
traverseAncestors(callback: (object: Object3D) => void): voidWalks UP the tree from parent to root. Does NOT include the starting object.
getObjectByName(name: string): Object3D | undefinedRecursive search. Returns first match or undefined.
getObjectById(id: number): Object3D | undefinedRecursive search by auto-generated id. Returns first match or undefined.
getObjectByProperty(name: string, value: any): Object3D | undefinedRecursive search by arbitrary property. Returns first match or undefined.
Transform Methods
lookAt(x: number, y: number, z: number): void
lookAt(vector: Vector3): voidRotates to face a world-space point. Cameras point negative-Z; other objects point positive-Z toward target.
rotateOnAxis(axis: Vector3, angle: number): thisRotates around a local-space axis by angle (radians).
rotateOnWorldAxis(axis: Vector3, angle: number): thisRotates around a world-space axis by angle (radians).
rotateX(angle: number): this
rotateY(angle: number): this
rotateZ(angle: number): thisShorthand for rotateOnAxis() on the respective axis.
translateOnAxis(axis: Vector3, distance: number): thisTranslates along a local-space axis.
translateX(distance: number): this
translateY(distance: number): this
translateZ(distance: number): thisShorthand for translateOnAxis() on the respective axis.
Coordinate Conversion Methods
localToWorld(vector: Vector3): Vector3Converts vector from local space to world space. MUTATES the input vector. Returns the same vector.
worldToLocal(vector: Vector3): Vector3Converts vector from world space to local space. MUTATES the input vector. Returns the same vector.
Matrix Update Methods
updateMatrix(): voidRecomputes matrix from position, rotation, and scale. Called automatically when matrixAutoUpdate is true.
updateMatrixWorld(force?: boolean): voidRecursively updates matrixWorld for this object and all descendants. When force is true, recalculates regardless of flags.
updateWorldMatrix(updateParents: boolean, updateChildren: boolean): voidGranular matrix update. updateParents: walks up to root first. updateChildren: recursively updates descendants after.
World-Space Query Methods
getWorldPosition(target: Vector3): Vector3Writes world position to target. Calls updateWorldMatrix(true, false) internally.
getWorldQuaternion(target: Quaternion): QuaternionWrites world rotation to target. Calls updateWorldMatrix(true, false) internally.
getWorldScale(target: Vector3): Vector3Writes world scale to target. Calls updateWorldMatrix(true, false) internally.
getWorldDirection(target: Vector3): Vector3Writes world-space forward direction to target. For cameras: negative-Z. For others: positive-Z.
Utility Methods
clone(recursive?: boolean): Object3DReturns a new Object3D with copied properties. When recursive is true (default), clones all descendants. userData is shallow-copied.
copy(source: Object3D, recursive?: boolean): thisCopies properties from source. Returns this.
toJSON(meta?: object): objectSerializes to JSON format.
applyMatrix4(matrix: Matrix4): voidApplies a matrix transform to the object. Updates position, quaternion, and scale from the decomposed matrix.
applyQuaternion(quaternion: Quaternion): thisApplies a quaternion rotation. Returns this.
Scene
Extends Object3D. Root container for all renderable objects.
Constructor
new Scene()Properties
background: Color | Texture | CubeTexture | null // default: null
environment: Texture | null // default: null -- IBL for all PBR materials
fog: Fog | FogExp2 | null // default: null
overrideMaterial: Material | null // default: null
backgroundBlurriness: number // default: 0 (range 0-1)
backgroundIntensity: number // default: 1
backgroundRotation: Euler // default: (0, 0, 0)
environmentIntensity: number // default: 1
environmentRotation: Euler // default: (0, 0, 0)Type Flags
isScene: true // read-only type check flagFog
Constructor
new Fog(color: Color | string | number, near?: number, far?: number)near: distance where fog starts (default:1)far: distance where fog is fully opaque (default:1000)- Linear interpolation between near and far
Properties
isFog: true // read-only type check flag
color: Color // fog color
near: number // start distance
far: number // end distanceFogExp2
Constructor
new FogExp2(color: Color | string | number, density?: number)density: exponential density coefficient (default:0.00025)
Properties
isFogExp2: true // read-only type check flag
color: Color // fog color
density: number // exponential densityGroup
Extends Object3D. Semantic container with no additional properties or methods.
Constructor
new Group()Type Flags
isGroup: true // read-only type check flagMesh
Extends Object3D. Combines geometry and material into a renderable surface.
Constructor
new Mesh(geometry?: BufferGeometry, material?: Material | Material[])geometry: defaults to emptyBufferGeometrymaterial: defaults toMeshBasicMaterialwith random color. Pass an array for multi-material rendering with geometry groups.
Properties
isMesh: true // read-only type check flag
geometry: BufferGeometry // the geometry
material: Material | Material[] // single or multi-material
morphTargetInfluences: number[] | undefined // blend weights for morph targets (0-1)
morphTargetDictionary: object | undefined // name-to-index mapping for morph targetsMethods
getVertexPosition(index: number, target: Vector3): Vector3Returns the local-space position of the vertex at the given index. Accounts for morph targets and skinning.
updateMorphTargets(): voidRebuilds morphTargetInfluences and morphTargetDictionary from the geometry.
raycast(raycaster: Raycaster, intersects: Intersection[]): voidTests for ray intersection. Called internally by Raycaster.intersectObject().
Layers
32-bit bitmask system for selective rendering and raycasting.
Constructor
new Layers()Creates a Layers object with layer 0 enabled.
Methods
set(channel: number): voidEnables ONLY this channel (0-31). Disables all others.
enable(channel: number): voidEnables a channel without affecting others.
enableAll(): voidEnables all 32 channels.
toggle(channel: number): voidFlips a channel on/off.
disable(channel: number): voidDisables a channel without affecting others.
disableAll(): voidDisables all 32 channels.
isEnabled(channel: number): booleanReturns true if the specified channel is enabled.
test(layers: Layers): booleanReturns true if ANY channel overlaps between this and the given Layers (bitwise AND).
Properties
mask: number // the raw 32-bit bitmask. Default: 1 (layer 0)