@lakuna/uscene
    Preparing search index...

    Class Node

    A node in a scene graph.

    Hierarchy (View Summary)

    Index

    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: undefined | Node): void

      Parameters

      • value: undefined | Node

      Returns void

    • get rotation(): Float32Array<ArrayBufferLike> & QuaternionLike

      The rotation of this node relative to its parent.

      Returns Float32Array<ArrayBufferLike> & QuaternionLike

    • set rotation(value: QuaternionLike): void

      Parameters

      • value: QuaternionLike

      Returns void

    • get scaling(): Float32Array<ArrayBufferLike> & Vector3Like

      The scaling of this node relative to its parent.

      Returns Float32Array<ArrayBufferLike> & Vector3Like

    • set scaling(value: Vector3Like): void

      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: Vector3Like): void

      Parameters

      • value: Vector3Like

      Returns void

    Methods

    • Add a child to this node.

      Parameters

      • node: Node

        The child.

      Returns void

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

      Returns void

    • Remove a child from 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

    • Perform 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