Skeleton

Class used to handle skinning animations

see

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

Hierarchy

  • Skeleton

Implements

Index

Constructors

constructor

Find examples in Playground
  • 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

animationPropertiesOverride

Find examples in Playground
animationPropertiesOverride: Nullable<AnimationPropertiesOverride>

Gets or sets the animation properties override

animations

Find examples in Playground
animations: Array<Animation>

Gets the list of animations attached to this skeleton

bones

Find examples in Playground
bones: Bone[]

Gets the list of child bones

dimensionsAtRest

Find examples in Playground
dimensionsAtRest: Vector3

Gets an estimate of the dimension of the skeleton at rest

doNotSerialize

Find examples in Playground
doNotSerialize: boolean

Specifies if the skeleton should be serialized

id

Find examples in Playground
id: string

defines the skeleton Id

name

Find examples in Playground
name: string

defines the skeleton name

needInitialSkinMatrix

Find examples in Playground
needInitialSkinMatrix: boolean

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

onBeforeComputeObservable

Find examples in Playground
onBeforeComputeObservable: Observable<Skeleton>

An observable triggered before computing the skeleton's matrices

Methods

beginAnimation

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

      defines a callback which will be called when animation will end

        • (): void
        • Returns void

    Returns Nullable<Animatable>

    a new animatable

clone

Find examples in Playground
  • clone(name: string, id: string): Skeleton
  • Clone the current skeleton

    Parameters

    • name: string

      defines the name of the new skeleton

    • id: string

      defines the id of the enw skeleton

    Returns Skeleton

    the new skeleton

computeAbsoluteTransforms

Find examples in Playground
  • 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

copyAnimationRange

Find examples in Playground
  • 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

createAnimationRange

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

deleteAnimationRange

Find examples in Playground
  • 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

dispose

Find examples in Playground
  • dispose(): void
  • Releases all resources associated with the current skeleton

    Returns void

enableBlending

Find examples in Playground
  • enableBlending(blendingSpeed?: number): void

getAnimatables

Find examples in Playground
  • Gets the list of animatables currently running for this skeleton

    Returns IAnimatable[]

    an array of animatables

getAnimationRange

Find examples in Playground
  • 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

getAnimationRanges

Find examples in Playground

getBoneIndexByName

Find examples in Playground
  • 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

getPoseMatrix

Find examples in Playground

getScene

Find examples in Playground
  • Gets the current hosting scene

    Returns Scene

    a scene object

getTransformMatrices

Find examples in Playground
  • 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

prepare

Find examples in Playground
  • prepare(): void
  • Build all resources required to render a skeleton

    Returns void

returnToRest

Find examples in Playground
  • returnToRest(): void
  • Forces the skeleton to go to rest pose

    Returns void

serialize

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

    Returns any

    a JSON object

sortBones

Find examples in Playground
  • sortBones(): void
  • Sorts bones per internal index

    Returns void

toString

Find examples in Playground
  • 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 Parse

Find examples in Playground
  • 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

Generated using TypeDoc