TransformNode

Hierarchy

Implements

Index

Constructors

constructor

Properties

absolutePosition

absolutePosition: Vector3

Returns the current mesh absolute position. Retuns a Vector3.

animationPropertiesOverride

animationPropertiesOverride: Nullable<AnimationPropertiesOverride>

Gets or sets the animation properties override

animations

animations: Animation[]

Gets a list of Animations associated with the node

behaviors

behaviors: Behavior<Node>[]

Gets the list of attached behaviors

see

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

billboardMode

billboardMode: number

doNotSerialize

doNotSerialize: boolean

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

forward

forward: Vector3

The forward direction of that transform in world space.

id

id: string

Gets or sets the id of the node

infiniteDistance

infiniteDistance: boolean

isWorldMatrixFrozen

isWorldMatrixFrozen: boolean

True if the World matrix has been frozen. Returns a boolean.

metadata

metadata: any

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

name

name: string

Gets or sets the name of the node

nonUniformScaling

nonUniformScaling: boolean

onAfterWorldMatrixUpdateObservable

onAfterWorldMatrixUpdateObservable: Observable<TransformNode>

An event triggered after the world matrix is updated

onDispose

onDispose: function

Sets a callback that will be raised when the node will be disposed

Type declaration

    • (): void
    • Returns void

onDisposeObservable

onDisposeObservable: Observable<Node>

An event triggered when the mesh is disposed

onReady

onReady: function

Callback raised when the node is ready to be used

Type declaration

    • (node: Node): void
    • Parameters

      Returns void

parent

parent: Nullable<Node>

Gets or sets the parent of the node

position

position: Vector3

right

right: Vector3

The right direction of that transform in world space.

rotation

rotation: Vector3

Rotation property : a Vector3 depicting the rotation value in radians around each local axis X, Y, Z. If rotation quaternion is set, this Vector3 will (almost always) be the Zero vector! Default : (0.0, 0.0, 0.0)

rotationQuaternion

rotationQuaternion: Nullable<Quaternion>

Rotation Quaternion property : this a Quaternion object depicting the mesh rotation by using a unit quaternion. It's null by default. If set, only the rotationQuaternion is then used to compute the mesh rotation and its property `.rotation\ is then ignored and set to (0.0, 0.0, 0.0)

scaling

scaling: Vector3

Scaling property : a Vector3 depicting the mesh scaling along each local axis X, Y, Z. Default : (1.0, 1.0, 1.0)

scalingDeterminant

scalingDeterminant: number

state

state: string

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

uniqueId

uniqueId: number

Gets or sets the unique id of the node

up

The up direction of that transform in world space.

worldMatrixFromCache

worldMatrixFromCache: Matrix

Returns directly the latest state of the mesh World matrix. A Matrix is returned.

Static BILLBOARDMODE_ALL

BILLBOARDMODE_ALL: number

Static BILLBOARDMODE_NONE

BILLBOARDMODE_NONE: number

Static BILLBOARDMODE_X

BILLBOARDMODE_X: number

Static BILLBOARDMODE_Y

BILLBOARDMODE_Y: number

Static BILLBOARDMODE_Z

BILLBOARDMODE_Z: number

Methods

addBehavior

addRotation

  • Adds a rotation step to the mesh current rotation. x, y, z are Euler angles expressed in radians. This methods updates the current mesh rotation, either mesh.rotation, either mesh.rotationQuaternion if it's set. This means this rotation is made in the mesh local space only. It's useful to set a custom rotation order different from the BJS standard one YXZ. Example : this rotates the mesh first around its local X axis, then around its local Z axis, finally around its local Y axis.

    mesh.addRotation(x1, 0, 0).addRotation(0, 0, z2).addRotation(0, 0, y3);
    

    Note that addRotation() accumulates the passed rotation values to the current ones and computes the .rotation or .rotationQuaternion updated values. Under the hood, only quaternions are used. So it's a little faster is you use .rotationQuaternion because it doesn't need to translate them back to Euler angles. Returns the TransformNode.

    Parameters

    • x: number
    • y: number
    • z: number

    Returns TransformNode

attachToBone

  • Attach the current TransformNode to another TransformNode associated with a bone

    Parameters

    • bone: Bone

      Bone affecting the TransformNode

    • affectedTransformNode: TransformNode

      TransformNode associated with the bone

    Returns TransformNode

beginAnimation

  • beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: function): 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: function

      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

clone

  • Clone the current transform node Returns the new transform node

    Parameters

    • name: string

      Name of the new clone

    • newParent: Node

      New parent for the clone

    • Optional doNotCloneChildren: boolean

      Do not clone children hierarchy

    Returns Nullable<TransformNode>

computeWorldMatrix

  • computeWorldMatrix(force?: boolean): Matrix
  • Computes the mesh World matrix and returns it. If the mesh world matrix is frozen, this computation does nothing more than returning the last frozen values. If the parameter force is let to false (default), the current cached World matrix is returned. If the parameter forceis set to true, the actual computation is done. Returns the mesh World Matrix.

    Parameters

    • Optional force: boolean

    Returns Matrix

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

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

detachFromBone

dispose

  • dispose(doNotRecurse?: boolean, disposeMaterialAndTextures?: boolean): void
  • Releases resources associated with this transform 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

freezeWorldMatrix

  • Prevents the World matrix to be computed any longer. Returns the TransformNode.

    Returns TransformNode

getAbsolutePivotPoint

  • Returns a new Vector3 set with the mesh pivot point World coordinates.

    Returns Vector3

getAbsolutePivotPointToRef

  • Sets the Vector3 "result" coordinates with the mesh pivot point World coordinates. Returns the TransformNode.

    Parameters

    Returns TransformNode

getAbsolutePosition

  • Retuns the mesh absolute position in the World. Returns a Vector3.

    Returns Vector3

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

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

getBehaviorByName

getChildMeshes

  • getChildMeshes(directDescendantsOnly?: boolean, predicate?: function): 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

    • Optional predicate: function

      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 {BABYLON.AbstractMesh}

getChildTransformNodes

  • getChildTransformNodes(directDescendantsOnly?: boolean, predicate?: function): TransformNode[]
  • Get all child-transformNodes 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

    • Optional predicate: function

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

    an array of {BABYLON.TransformNode}

getChildren

  • getChildren(predicate?: function): Node[]
  • Get all direct children of this node

    Parameters

    • Optional predicate: function

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

    an array of {BABYLON.Node}

getClassName

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

    Returns string

    "TransformNode" string

getDescendants

  • getDescendants(directDescendantsOnly?: boolean, predicate?: function): Node[]
  • 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: function

      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

getDirection

  • Returns a new Vector3 what is the localAxis, expressed in the mesh local space, rotated like the mesh. This Vector3 is expressed in the World space.

    Parameters

    Returns Vector3

getDirectionToRef

  • Sets the Vector3 "result" as the rotated Vector3 "localAxis" in the same rotation than the mesh. localAxis is expressed in the mesh local space. result is computed in the Wordl space from the mesh World matrix. Returns the TransformNode.

    Parameters

    Returns TransformNode

getEngine

getPivotMatrix

  • Returns the mesh pivot matrix. Default : Identity. A Matrix is returned.

    Returns Matrix

getPivotPoint

  • Returns a new Vector3 set with the mesh pivot point coordinates in the local space.

    Returns Vector3

getPivotPointToRef

  • Sets the passed Vector3 "result" with the coordinates of the mesh pivot point in the local space. Returns the TransformNode.

    Parameters

    Returns TransformNode

getPoseMatrix

  • Returns the mesh Pose matrix. Returned object : Matrix

    Returns Matrix

getPositionExpressedInLocalSpace

  • getPositionExpressedInLocalSpace(): Vector3
  • Returns the mesh position in the local space from the current World matrix values. Returns a new Vector3.

    Returns Vector3

getScene

  • Gets the scene of the node

    Returns Scene

    a {BABYLON.Scene}

getWorldMatrix

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

isDisposed

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

    Returns boolean

    true if the node was disposed

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

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

locallyTranslate

  • Translates the mesh along the passed Vector3 in its local space. Returns the TransformNode.

    Parameters

    Returns TransformNode

lookAt

  • Orients a mesh towards a target point. Mesh must be drawn facing user.

    Parameters

    • targetPoint: Vector3

      the position (must be in same space as current mesh) to look at

    • Optional yawCor: number

      optional yaw (y-axis) correction in radians

    • Optional pitchCor: number

      optional pitch (x-axis) correction in radians

    • Optional rollCor: number

      optional roll (z-axis) correction in radians

    • Optional space: Space

      the choosen space of the target

    Returns TransformNode

    the TransformNode.

markAsDirty

registerAfterWorldMatrixUpdate

  • If you'd like to be called back after the mesh position, rotation or scaling has been updated.

    Parameters

    Returns TransformNode

removeBehavior

rotate

  • Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in the given space. space (default LOCAL) can be either BABYLON.Space.LOCAL, either BABYLON.Space.WORLD. Note that the property rotationQuaternion is then automatically updated and the property rotation is set to (0,0,0) and no longer used. The passed axis is also normalized. Returns the TransformNode.

    Parameters

    Returns TransformNode

rotateAround

serialize

  • serialize(currentSerializationObject?: any): any
  • Parameters

    • Optional currentSerializationObject: any

    Returns any

serializeAnimationRanges

  • serializeAnimationRanges(): any

setAbsolutePosition

  • Sets the mesh absolute position in the World from a Vector3 or an Array(3). Returns the TransformNode.

    Parameters

    Returns TransformNode

setEnabled

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

    Parameters

    • value: boolean

      defines the new enabled state

    Returns void

setParent

  • Defines the passed node as the parent of the current node. The node will remain exactly where it is and its position / rotation will be updated accordingly Returns the TransformNode.

    Parameters

    Returns TransformNode

setPivotMatrix

  • Sets a new pivot matrix to the current node

    Parameters

    • matrix: Matrix

      defines the new pivot matrix to use

    • Optional postMultiplyPivotMatrix: boolean

      defines if the pivot matrix must be cancelled in the world matrix. When this parameter is set to true (default), the inverse of the pivot matrix is also applied at the end to cancel the transformation effect

    Returns TransformNode

    the current TransformNode

setPivotPoint

  • Sets a new pivot point to the current node

    Parameters

    • point: Vector3

      defines the new pivot point to use

    • Optional space: Space

      defines if the point is in world or local space (local by default)

    Returns TransformNode

    the current TransformNode

setPositionWithLocalVector

  • Sets the mesh position in its local space. Returns the TransformNode.

    Parameters

    Returns TransformNode

setPreTransformMatrix

  • Sets a new matrix to apply before all other transformation

    Parameters

    • matrix: Matrix

      defines the transform matrix

    Returns TransformNode

    the current TransformNode

translate

  • Translates the mesh along the axis vector for the passed distance in the given space. space (default LOCAL) can be either BABYLON.Space.LOCAL, either BABYLON.Space.WORLD. Returns the TransformNode.

    Parameters

    Returns TransformNode

unfreezeWorldMatrix

  • unfreezeWorldMatrix(): this
  • Allows back the World matrix computation. Returns the TransformNode.

    Returns this

unregisterAfterWorldMatrixUpdate

  • unregisterAfterWorldMatrixUpdate(func: function): TransformNode

updatePoseMatrix

  • Copies the paramater passed Matrix into the mesh Pose matrix. Returns the TransformNode.

    Parameters

    Returns TransformNode

Static Parse

  • Returns a new TransformNode object parsed from the source provided. The parameter parsedMesh is the source. The parameter rootUrl is a string, it's the root URL to prefix the delayLoadingFile property with

    Parameters

    • parsedTransformNode: any
    • scene: Scene
    • rootUrl: string

    Returns TransformNode

Static 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

Generated using TypeDoc