Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Skeleton

Class used to handle skinning animations

see

https://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons

Hierarchy

  • Skeleton

Implements

Index

Constructors

constructor

  • Creates a new skeleton

    Parameters

    • name: string

      defines the skeleton name

    • id: string

      defines the skeleton Id

    • scene: Scene

      defines the hosting scene

    Returns Skeleton

Properties

animationsSearch playground for animations

animations: Array<Animation>

Gets the list of animations attached to this skeleton

bonesSearch playground for bones

bones: Bone[]

Defines the list of child bones

dimensionsAtRestSearch playground for dimensionsAtRest

dimensionsAtRest: Vector3

Defines an estimate of the dimension of the skeleton at rest

doNotSerializeSearch playground for doNotSerialize

doNotSerialize: boolean

Specifies if the skeleton should be serialized

idSearch playground for id

id: string

defines the skeleton Id

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

nameSearch playground for name

name: string

defines the skeleton name

needInitialSkinMatrixSearch playground for needInitialSkinMatrix

needInitialSkinMatrix: boolean

Defines a boolean indicating if the root matrix is provided by meshes or by the current skeleton (this is the default value)

onBeforeComputeObservableSearch playground for onBeforeComputeObservable

onBeforeComputeObservable: Observable<Skeleton>

An observable triggered before computing the skeleton's matrices

Accessors

animationPropertiesOverride

isUsingTextureForMatrices

  • get isUsingTextureForMatrices(): boolean
  • Gets a boolean indicating that the skeleton effectively stores matrices into a texture

    Returns boolean

uniqueId

  • get uniqueId(): number
  • Gets the unique ID of this skeleton

    Returns number

useTextureToStoreBoneMatrices

  • get useTextureToStoreBoneMatrices(): boolean
  • set useTextureToStoreBoneMatrices(value: boolean): any
  • Gets or sets a boolean indicating that bone matrices should be stored as a texture instead of using shader uniforms (default is true). Please note that this option is not available if the hardware does not support it

    Returns boolean

  • Gets or sets a boolean indicating that bone matrices should be stored as a texture instead of using shader uniforms (default is true). Please note that this option is not available if the hardware does not support it

    Parameters

    • value: boolean

    Returns any

Methods

beginAnimationSearch playground for beginAnimation

  • beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Nullable<Animatable>
  • Begin a specific animation range

    Parameters

    • name: string

      defines the name of the range to start

    • Optional loop: boolean

      defines if looping must be turned on (false by default)

    • Optional speedRatio: number

      defines the speed ratio to apply (1 by default)

    • Optional onAnimationEnd: () => void

      defines a callback which will be called when animation will end

        • (): void
        • Returns void

    Returns Nullable<Animatable>

    a new animatable

cloneSearch playground for clone

  • clone(name: string, id?: string): Skeleton
  • Clone the current skeleton

    Parameters

    • name: string

      defines the name of the new skeleton

    • Optional id: string

      defines the id of the new skeleton

    Returns Skeleton

    the new skeleton

computeAbsoluteTransformsSearch playground for computeAbsoluteTransforms

  • computeAbsoluteTransforms(forceUpdate?: boolean): void
  • Compute all node absolute transforms

    Parameters

    • Optional forceUpdate: boolean

      defines if computation must be done even if cache is up to date

    Returns void

copyAnimationRangeSearch playground for copyAnimationRange

  • copyAnimationRange(source: Skeleton, name: string, rescaleAsRequired?: boolean): boolean
  • Copy animation range from a source skeleton. This is not for a complete retargeting, only between very similar skeleton's with only possible bone length differences

    Parameters

    • source: Skeleton

      defines the source skeleton

    • name: string

      defines the name of the range to copy

    • Optional rescaleAsRequired: boolean

      defines if rescaling must be applied if required

    Returns boolean

    true if operation was successful

createAnimationRangeSearch playground for createAnimationRange

  • createAnimationRange(name: string, from: number, to: number): void
  • Create a new animation range

    Parameters

    • name: string

      defines the name of the range

    • from: number

      defines the start 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

    • Optional deleteFrames: boolean

      defines if frames must be removed as well

    Returns void

disposeSearch playground for dispose

  • dispose(): void
  • Releases all resources associated with the current skeleton

    Returns void

enableBlendingSearch playground for enableBlending

  • enableBlending(blendingSpeed?: number): void

getAnimatablesSearch playground for getAnimatables

  • Gets the list of animatables currently running for this skeleton

    Returns IAnimatable[]

    an array of animatables

getAnimationRangeSearch playground for getAnimationRange

  • Gets a specific animation range

    Parameters

    • name: string

      defines the name of the range to look for

    Returns Nullable<AnimationRange>

    the requested animation range or null if not found

getAnimationRangesSearch playground for getAnimationRanges

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

    Returns Nullable<AnimationRange>[]

    an array

getBoneIndexByNameSearch playground for getBoneIndexByName

  • getBoneIndexByName(name: string): number
  • Get bone's index searching by name

    Parameters

    • name: string

      defines bone's name to search for

    Returns number

    the indice of the bone. Returns -1 if not found

getChildrenSearch playground for getChildren

  • getChildren(): Array<Bone>
  • Returns an array containing the root bones

    Returns Array<Bone>

    an array containing the root bones

getClassNameSearch playground for getClassName

  • getClassName(): string
  • Gets the current object class name.

    Returns string

    the class name

getPoseMatrixSearch playground for getPoseMatrix

  • Gets the root pose matrix

    Returns Nullable<Matrix>

    a matrix

getSceneSearch playground for getScene

  • Gets the current hosting scene

    Returns Scene

    a scene object

getTransformMatricesSearch playground for getTransformMatrices

  • Gets the list of transform matrices to send to shaders (one matrix per bone)

    Parameters

    • mesh: AbstractMesh

      defines the mesh to use to get the root matrix (if needInitialSkinMatrix === true)

    Returns Float32Array

    a Float32Array containing matrices data

getTransformMatrixTextureSearch playground for getTransformMatrixTexture

  • Gets the list of transform matrices to send to shaders inside a texture (one matrix per bone)

    Parameters

    • mesh: AbstractMesh

      defines the mesh to use to get the root matrix (if needInitialSkinMatrix === true)

    Returns Nullable<RawTexture>

    a raw texture containing the data

prepareSearch playground for prepare

  • prepare(): void
  • Build all resources required to render a skeleton

    Returns void

returnToRestSearch playground for returnToRest

  • returnToRest(): void
  • Forces the skeleton to go to rest pose

    Returns void

serializeSearch playground for serialize

  • serialize(): any
  • Serialize the skeleton in a JSON object

    Returns any

    a JSON object

setCurrentPoseAsRestSearch playground for setCurrentPoseAsRest

  • setCurrentPoseAsRest(): void
  • Set the current local matrix as the restPose for all bones in the skeleton.

    Returns void

sortBonesSearch playground for sortBones

  • sortBones(): void
  • Sorts bones per internal index

    Returns void

toStringSearch playground for toString

  • toString(fullDetails?: boolean): string
  • Gets a string representing the current skeleton data

    Parameters

    • Optional fullDetails: boolean

      defines a boolean indicating if we want a verbose version

    Returns string

    a string representing the current skeleton data

Static MakeAnimationAdditiveSearch playground for MakeAnimationAdditive

  • Convert the keyframes for a range of animation on a skeleton to be relative to a given reference frame.

    Parameters

    • skeleton: Skeleton

      defines the Skeleton containing the animation range to convert

    • referenceFrame: number | undefined

      defines the frame that keyframes in the range will be relative to

    • range: string

      defines the name of the AnimationRange belonging to the Skeleton to convert

    Returns Nullable<Skeleton>

    the original skeleton

Static ParseSearch playground for Parse

  • Creates a new skeleton from serialized data

    Parameters

    • parsedSkeleton: any

      defines the serialized data

    • scene: Scene

      defines the hosting scene

    Returns Skeleton

    a new skeleton

Legend

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