Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Node

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

Hierarchy

Implements

Index

Constructors

constructor

  • 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

animationsSearch playground for animations

animations: Animation[]

Gets a list of Animations associated with the node

idSearch playground for id

id: string

Gets or sets the id of the node

inspectableCustomPropertiesSearch playground for inspectableCustomProperties

inspectableCustomProperties: IInspectable[]

List of inspectable custom properties (used by the Inspector)

see

https://doc.babylonjs.com/how_to/debug_layer#extensibility

metadataSearch playground for metadata

metadata: any

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

nameSearch playground for name

name: string

Gets or sets the name of the node

onDisposeObservableSearch playground for onDisposeObservable

onDisposeObservable: Observable<Node>

An event triggered when the mesh is disposed

onReadySearch playground for onReady

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

Callback raised when the node is ready to be used

reservedDataStoreSearch playground for reservedDataStore

reservedDataStore: any

For internal use only. Please do not use.

stateSearch playground for state

state: string

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

uniqueIdSearch playground for uniqueId

uniqueId: number

Gets or sets the unique id of the node

Accessors

animationPropertiesOverride

behaviors

doNotSerialize

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

    Returns boolean

  • Gets or sets a boolean used to define if the node must be serialized

    Parameters

    • value: boolean

    Returns any

onClonedObservable

  • An event triggered when the node is cloned

    Returns Observable<Node>

onDispose

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

    Parameters

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

    Returns any

onEnabledStateChangedObservable

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

    Returns Observable<boolean>

parent

worldMatrixFromCache

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

    Returns Matrix

Methods

addBehaviorSearch playground for addBehavior

  • Attach a behavior to the node

    see

    https://doc.babylonjs.com/features/behaviour

    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

    the current Node

beginAnimationSearch playground for beginAnimation

  • beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Nullable<Animatable>
  • Will start the animation sequence

    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>

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

computeWorldMatrixSearch playground for computeWorldMatrix

  • computeWorldMatrix(force?: boolean): Matrix
  • Computes the world matrix of the node

    Parameters

    • Optional force: boolean

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

    Returns Matrix

    the world matrix

createAnimationRangeSearch playground for createAnimationRange

  • createAnimationRange(name: string, from: number, to: number): void
  • 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

deleteAnimationRangeSearch playground for deleteAnimationRange

  • deleteAnimationRange(name: string, deleteFrames?: boolean): 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

disposeSearch playground for dispose

  • dispose(doNotRecurse?: boolean, disposeMaterialAndTextures?: boolean): 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

getAnimationByNameSearch playground for getAnimationByName

  • Get an animation by name

    Parameters

    • name: string

      defines the name of the animation to look for

    Returns Nullable<Animation>

    null if not found else the requested animation

getAnimationRangeSearch playground for getAnimationRange

  • Get an animation range by name

    Parameters

    • name: string

      defines the name of the animation range to look for

    Returns Nullable<AnimationRange>

    null if not found else the requested animation range

getAnimationRangesSearch playground for getAnimationRanges

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

    Returns Nullable<AnimationRange>[]

    an array

getBehaviorByNameSearch playground for getBehaviorByName

getChildMeshesSearch playground for getChildMeshes

  • getChildMeshes<T>(directDescendantsOnly?: boolean, predicate?: (node: Node) => node is T): T[]
  • getChildMeshes(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): AbstractMesh[]
  • Get all child-meshes of this node

    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[]

    an array of AbstractMesh

  • Get all child-meshes of this node

    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[]

    an array of AbstractMesh

getChildrenSearch playground for getChildren

  • getChildren<T>(predicate?: (node: Node) => node is T, directDescendantsOnly?: boolean): T[]
  • getChildren(predicate?: (node: Node) => boolean, directDescendantsOnly?: boolean): Node[]
  • Get all direct children of this 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[]

    an array of Node

  • Get all direct children of this 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[]

    an array of Node

getClassNameSearch playground for getClassName

  • getClassName(): string
  • Gets a string identifying the name of the class

    Returns string

    "Node" string

getDescendantsSearch playground for getDescendants

  • getDescendants<T>(directDescendantsOnly?: boolean, predicate?: (node: Node) => node is T): T[]
  • getDescendants(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): Node[]
  • Will return all nodes that have this node as ascendant

    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[]

    all children nodes of all types

  • Will return all nodes that have this node as ascendant

    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[]

    all children nodes of all types

getEngineSearch playground for getEngine

  • Gets the engine of the node

    Returns Engine

    a Engine

getHierarchyBoundingVectorsSearch playground for getHierarchyBoundingVectors

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

    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 }

    the new bounding vectors

getSceneSearch playground for getScene

  • Gets the scene of the node

    Returns Scene

    a scene

getWorldMatrixSearch playground for getWorldMatrix

  • Returns the latest update of the World matrix

    Returns Matrix

    a Matrix

isDescendantOfSearch playground for isDescendantOf

  • isDescendantOf(ancestor: Node): boolean
  • 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

    Parameters

    • ancestor: Node

      defines the parent node to inspect

    Returns boolean

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

isDisposedSearch playground for isDisposed

  • isDisposed(): boolean
  • Gets a boolean indicating if the node has been disposed

    Returns boolean

    true if the node was disposed

isEnabledSearch playground for isEnabled

  • isEnabled(checkAncestors?: boolean): 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

    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

    whether this node (and its parent) is enabled

isReadySearch playground for isReady

  • isReady(completeCheck?: boolean): boolean
  • Is this node ready to be used/rendered

    Parameters

    • Optional completeCheck: boolean

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

    Returns boolean

    true if the node is ready

markAsDirtySearch playground for markAsDirty

  • markAsDirty(property?: string): Node
  • Flag the node as dirty (Forcing it to update everything)

    Parameters

    • Optional property: string

      helps children apply precise "dirtyfication"

    Returns Node

    this node

removeBehaviorSearch playground for removeBehavior

serializeAnimationRangesSearch playground for serializeAnimationRanges

  • serializeAnimationRanges(): any
  • Serialize animation ranges into a JSON compatible object

    Returns any

    serialization object

setEnabledSearch playground for setEnabled

  • setEnabled(value: boolean): void
  • Set the enabled state of this node

    Parameters

    • value: boolean

      defines the new enabled state

    Returns void

Static AddNodeConstructorSearch playground for AddNodeConstructor

  • 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

Static ConstructSearch playground for Construct

  • Construct(type: string, name: string, scene: Scene, options?: any): Nullable<() => Node>
  • Returns a node constructor based on type name

    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>

    the new constructor or null

Static ParseAnimationRangesSearch playground for ParseAnimationRanges

  • ParseAnimationRanges(node: Node, parsedNode: any, scene: Scene): void
  • 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

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method