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

  • 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

animationPropertiesOverride: Nullable<AnimationPropertiesOverride>

Gets or sets the animation properties override

animations

animations: Array<Animation>

Gets the list of animations attached to this skeleton

bones

bones: Bone[]

Gets the list of child bones

dimensionsAtRest

dimensionsAtRest: Vector3

Gets an estimate of the dimension of the skeleton at rest

doNotSerialize

doNotSerialize: boolean

Specifies if the skeleton should be serialized

id

id: string

defines the skeleton Id

name

name: string

defines the skeleton name

needInitialSkinMatrix

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

onBeforeComputeObservable: Observable<Skeleton>

An observable triggered before computing the skeleton's matrices

Methods

beginAnimation

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

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

    Returns void

enableBlending

  • enableBlending(blendingSpeed?: number): void

getAnimatables

  • Gets the list of animatables currently running for this skeleton

    Returns IAnimatable[]

    an array of animatables

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

getAnimationRanges

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

getPoseMatrix

getScene

  • Gets the current hosting scene

    Returns Scene

    a scene object

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

prepare

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

    Returns void

returnToRest

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

    Returns void

serialize

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

    Returns any

    a JSON object

sortBones

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

    Returns void

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

Generated using TypeDoc