A node in a scene graph.

Hierarchy (view full)

Constructors

  • Create a node in a scene graph.

    Parameters

    • Optionalparent: Node

      The parent of the node. Should only be undefined for the root of a scene graph.

    • enabled: boolean = true

      Whether or not the node should be enabled.

    Returns Node

Properties

enabled: boolean

Whether or not this node is enabled. Disabled nodes and their descendents are not included in traversals.

matrix: Matrix4Like

The transformation matrix of this node relative to its parent.

Accessors

  • get children(): readonly Node[]
  • The children of this node. Do not modify this value directly (use addChild and removeChild instead).

    Returns readonly Node[]

  • get parent(): undefined | Node
  • The parent of this node.

    Returns undefined | Node

  • set parent(value): void
  • The parent of this node.

    Parameters

    • value: undefined | Node

    Returns void

  • get rotation(): Float32Array & QuaternionLike
  • The rotation of this node relative to its parent.

    Returns Float32Array & QuaternionLike

  • set rotation(value): void
  • The rotation of this node relative to its parent.

    Parameters

    • value: QuaternionLike

    Returns void

  • get scaling(): Float32Array & Vector3Like
  • The scale of this node relative to its parent.

    Returns Float32Array & Vector3Like

  • set scaling(value): void
  • The scale of this node relative to its parent.

    Parameters

    • value: Vector3Like

    Returns void

  • get translation(): Readonly<Float32Array & Vector3Like>
  • The translation of this node relative to its parent.

    Returns Readonly<Float32Array & Vector3Like>

  • set translation(value): void
  • The translation of this node relative to its parent.

    Parameters

    • value: Vector3Like

    Returns void

Methods

  • Adds a child to this node.

    Parameters

    • node: Node

      The child.

    Returns void

  • Reset this node's transformation relative to its parent.

    Returns void

  • Removes a child to this node.

    Parameters

    • node: Node

      The child.

    Returns void

  • Rotate this node relative to its parent.

    Parameters

    • r: number

      The number of radians to rotate by.

    • axis: Vector3Like

      The axis to rotate around.

    Returns void

  • Rotate this node around the X-axis relative to its parent.

    Parameters

    • r: number

      The number of radians to rotate by.

    Returns void

  • Rotate this node around the Y-axis relative to its parent.

    Parameters

    • r: number

      The number of radians to rotate by.

    Returns void

  • Rotate this node around the Z-axis relative to its parent.

    Parameters

    • r: number

      The number of radians to rotate by.

    Returns void

  • Scale this node relative to its parent.

    Parameters

    • s: Vector3Like

      The scaling factor.

    Returns void

  • Position this node such that it is pointing at a target position.

    Parameters

    • eye: Vector3Like

      The new position of this node.

    • target: Vector3Like

      The position for this node to point at.

    • up: Vector3Like = ...

      The up vector.

    Returns void

  • Translate this node relative to its parent.

    Parameters

    • t: Vector3Like

      The translation vector.

    Returns void

  • Performs a function on this node and each of its children recursively.

    Parameters

    • f: ((self: Node, worldMatrix: Matrix4Like) => boolean) | ((self: Node, worldMatrix: Matrix4Like) => void)

      The function to perform for each node. Receives as an argument the node and the node's world matrix. If this function returns true, the node's children are not included in the traversal.

    Returns void