Node is the basic class for all scene objects (Mesh, Light, Camera.)

Hierarchy

Implements

  • IBehaviorAware<Node>

Constructors

  • Creates a new Node

    Parameters

    • name: string

      the name and id to be given to this node

    • Optional scene: Nullable<Scene>

      the scene this node will be added to

    Returns Node

Properties

animations: BabylonAnimation[]

Gets a list of Animations associated with the node

id: string

Gets or sets the id of the node

inspectableCustomProperties: IInspectable[]

List of inspectable custom properties (used by the Inspector)

See

https://doc.babylonjs.com/toolsAndResources/inspector#extensibility

metadata: any

Gets or sets an object used to store user defined information for the node

name: string

Gets or sets the name of the node

onAccessibilityTagChangedObservable: Observable<Nullable<IAccessibilityTag>>
onDisposeObservable: Observable<Node>

An event triggered when the mesh is disposed

onReady: Nullable<((node: Node) => void)>

Callback raised when the node is ready to be used

reservedDataStore: any

For internal use only. Please do not use.

state: string

Gets or sets a string used to store user defined state for the node

uniqueId: number

Gets or sets the unique id of the node

Accessors

  • get accessibilityTag(): Nullable<IAccessibilityTag>
  • Returns Nullable<IAccessibilityTag>

  • set accessibilityTag(value: Nullable<IAccessibilityTag>): void
  • Gets or sets the accessibility tag to describe the node for accessibility purpose.

    Parameters

    • value: Nullable<IAccessibilityTag>

    Returns void

  • get animationPropertiesOverride(): Nullable<AnimationPropertiesOverride>
  • Gets or sets the animation properties override

    Returns Nullable<AnimationPropertiesOverride>

  • set animationPropertiesOverride(value: Nullable<AnimationPropertiesOverride>): void
  • Parameters

    • value: Nullable<AnimationPropertiesOverride>

    Returns void

  • get doNotSerialize(): boolean
  • Gets or sets a boolean used to define if the node must be serialized

    Returns boolean

  • set doNotSerialize(value: boolean): void
  • Parameters

    • value: boolean

    Returns void

  • get onClonedObservable(): Observable<Node>
  • An event triggered when the node is cloned

    Returns Observable<Node>

  • set onDispose(callback: (() => void)): void
  • Sets a callback that will be raised when the node will be disposed

    Parameters

    • callback: (() => void)
        • (): void
        • Returns void

    Returns void

  • get onEnabledStateChangedObservable(): Observable<boolean>
  • An event triggered when the enabled state of the node changes

    Returns Observable<boolean>

  • get worldMatrixFromCache(): Matrix
  • Returns directly the latest state of the mesh World matrix. A Matrix is returned.

    Returns Matrix

Methods

  • Attach a behavior to the node

    See

    https://doc.babylonjs.com/features/featuresDeepDive/behaviors

    Returns

    the current Node

    Parameters

    • behavior: Behavior<Node>

      defines the behavior to attach

    • Optional attachImmediately: boolean

      defines that the behavior must be attached even if the scene is still loading

    Returns Node

  • Will start the animation sequence

    Returns

    the object created for this animation. If range does not exist, it will return null

    Parameters

    • name: string

      defines the range frames for animation sequence

    • Optional loop: boolean

      defines if the animation should loop (false by default)

    • Optional speedRatio: number

      defines the speed factor in which to run the animation (1 by default)

    • Optional onAnimationEnd: (() => void)

      defines a function to be executed when the animation ended (undefined by default)

        • (): void
        • Returns void

    Returns Nullable<Animatable>

  • Clone the current node

    Returns

    the new transform node

    Parameters

    • name: string

      Name of the new clone

    • newParent: Nullable<Node>

      New parent for the clone

    • Optional doNotCloneChildren: boolean

      Do not clone children hierarchy

    Returns Nullable<Node>

  • Computes the world matrix of the node

    Returns

    the world matrix

    Parameters

    • Optional _force: boolean

      defines if the cache version should be invalidated forcing the world matrix to be created from scratch

    Returns Matrix

  • Creates an animation range for this node

    Parameters

    • name: string

      defines the name of the range

    • from: number

      defines the starting key

    • to: number

      defines the end key

    Returns void

  • Delete a specific animation range

    Parameters

    • name: string

      defines the name of the range to delete

    • Optional deleteFrames: boolean

      defines if animation frames from the range must be deleted as well

    Returns void

  • Releases resources associated with this node.

    Parameters

    • Optional doNotRecurse: boolean

      Set to true to not recurse into each children (recurse into each children by default)

    • Optional disposeMaterialAndTextures: boolean

      Set to true to also dispose referenced materials and textures (false by default)

    Returns void

  • Get an animation by name

    Returns

    null if not found else the requested animation

    Parameters

    • name: string

      defines the name of the animation to look for

    Returns Nullable<BabylonAnimation>

  • Get an animation range by name

    Returns

    null if not found else the requested animation range

    Parameters

    • name: string

      defines the name of the animation range to look for

    Returns Nullable<AnimationRange>

  • Gets the list of all animation ranges defined on this node

    Returns

    an array

    Returns Nullable<AnimationRange>[]

  • Gets an attached behavior by name

    See

    https://doc.babylonjs.com/features/featuresDeepDive/behaviors

    Returns

    null if behavior was not found else the requested behavior

    Parameters

    • name: string

      defines the name of the behavior to look for

    Returns Nullable<Behavior<Node>>

  • Get all child-meshes of this node

    Returns

    an array of AbstractMesh

    Type Parameters

    Parameters

    • Optional directDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: false)

    • Optional predicate: ((node: Node) => node is T)

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

        • (node: Node): node is T
        • Parameters

          Returns node is T

    Returns T[]

  • Get all child-meshes of this node

    Returns

    an array of AbstractMesh

    Parameters

    • Optional directDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: false)

    • Optional predicate: ((node: Node) => boolean)

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

        • (node: Node): boolean
        • Parameters

          Returns boolean

    Returns AbstractMesh[]

  • Get all direct children of this node

    Returns

    an array of Node

    Type Parameters

    Parameters

    • Optional predicate: ((node: Node) => node is T)

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

        • (node: Node): node is T
        • Parameters

          Returns node is T

    • Optional directDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: true)

    Returns T[]

  • Get all direct children of this node

    Returns

    an array of Node

    Parameters

    • Optional predicate: ((node: Node) => boolean)

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

        • (node: Node): boolean
        • Parameters

          Returns boolean

    • Optional directDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: true)

    Returns Node[]

  • Gets a string identifying the name of the class

    Returns

    "Node" string

    Returns string

  • Will return all nodes that have this node as ascendant

    Returns

    all children nodes of all types

    Type Parameters

    Parameters

    • Optional directDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered

    • Optional predicate: ((node: Node) => node is T)

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

        • (node: Node): node is T
        • Parameters

          Returns node is T

    Returns T[]

  • Will return all nodes that have this node as ascendant

    Returns

    all children nodes of all types

    Parameters

    • Optional directDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered

    • Optional predicate: ((node: Node) => boolean)

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

        • (node: Node): boolean
        • Parameters

          Returns boolean

    Returns Node[]

  • Gets the engine of the node

    Returns

    a Engine

    Returns Engine

  • Return the minimum and maximum world vectors of the entire hierarchy under current node

    Returns

    the new bounding vectors

    Parameters

    • Optional includeDescendants: boolean

      Include bounding info from descendants as well (true by default)

    • Optional predicate: Nullable<((abstractMesh: AbstractMesh) => boolean)>

      defines a callback function that can be customize to filter what meshes should be included in the list used to compute the bounding vectors

    Returns { max: Vector3; min: Vector3 }

  • Gets the scene of the node

    Returns

    a scene

    Returns Scene

  • Returns the latest update of the World matrix

    Returns

    a Matrix

    Returns Matrix

  • Is this node a descendant of the given node? The function will iterate up the hierarchy until the ancestor was found or no more parents defined

    Returns

    a boolean indicating if this node is a descendant of the given node

    Parameters

    • ancestor: Node

      defines the parent node to inspect

    Returns boolean

  • Gets a boolean indicating if the node has been disposed

    Returns

    true if the node was disposed

    Returns boolean

  • Is this node enabled? If the node has a parent, all ancestors will be checked and false will be returned if any are false (not enabled), otherwise will return true

    Returns

    whether this node (and its parent) is enabled

    Parameters

    • Optional checkAncestors: boolean

      indicates if this method should check the ancestors. The default is to check the ancestors. If set to false, the method will return the value of this node without checking ancestors

    Returns boolean

  • Is this node ready to be used/rendered

    Returns

    true if the node is ready

    Parameters

    • Optional _completeCheck: boolean

      defines if a complete check (including materials and lights) has to be done (false by default)

    Returns boolean

  • Flag the node as dirty (Forcing it to update everything)

    Returns

    this node

    Parameters

    • Optional _property: string

      helps children apply precise "dirtyfication"

    Returns Node

  • Serialize animation ranges into a JSON compatible object

    Returns

    serialization object

    Returns any

  • Set the enabled state of this node

    Parameters

    • value: boolean

      defines the new enabled state

    Returns void

  • Add a new node constructor

    Parameters

    • type: string

      defines the type name of the node to construct

    • constructorFunc: NodeConstructor

      defines the constructor function

    Returns void

  • Returns a node constructor based on type name

    Returns

    the new constructor or null

    Parameters

    • type: string

      defines the type name

    • name: string

      defines the new node name

    • scene: Scene

      defines the hosting scene

    • Optional options: any

      defines optional options to transmit to constructors

    Returns Nullable<(() => Node)>

  • Parse animation range data from a serialization object and store them into a given node

    Parameters

    • node: Node

      defines where to store the animation ranges

    • parsedNode: any

      defines the serialization object to read data from

    • _scene: Scene

      defines the hosting scene

    Returns void

Generated using TypeDoc