Click or drag to resize
DigitalRuneSkeletonPose Class
Defines an animation pose of a Skeleton.
Inheritance Hierarchy
SystemObject
  DigitalRune.Animation.CharacterSkeletonPose

Namespace: DigitalRune.Animation.Character
Assembly: DigitalRune.Animation (in DigitalRune.Animation.dll) Version: 1.4.0.0 (1.4.1.14427)
Syntax
public sealed class SkeletonPose : IAnimatableObject, 
	INamedObject, IAnimatableProperty<SkeletonPose>, IAnimatableProperty, IRecyclable

The SkeletonPose type exposes the following members.

Methods
  NameDescription
Public methodClone
Creates a new SkeletonPose that is a clone (deep copy) of the current instance.
Public methodStatic memberCreate
Creates an instance of the SkeletonPose class. (This method reuses a previously recycled instance or allocates a new instance if necessary.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodGetBonePoseAbsolute
Gets the absolute bone pose of the specified bone.
Public methodGetBonePoseRelative
Gets the relative bone pose of the specified bone.
Public methodGetBoneTransform
Gets the bone transform of the specified bone.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodRecycle
Recycles this instance of the SkeletonPose class.
Public methodResetBoneTransform
Resets the bone transforms of the specified bone.
Public methodResetBoneTransforms
Resets the bone transforms of all bones in the skeleton.
Public methodSetBoneTransform
Sets the bone transform of the specified bone.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodUpdate
Updates all bone transformations.
Top
Extension Methods
  NameDescription
Public Extension MethodDrawBones
Draws the skeleton bones, bone space axes and bone names for debugging. (Only available in the XNA-compatible build.)
(Defined by SkeletonHelper.)
Public Extension MethodGetChain
Gets the bone indices of a bone chain.
(Defined by SkeletonHelper.)
Public Extension MethodGetNumberOfBones
Counts the number of bones in a bone chain.
(Defined by SkeletonHelper.)
Public Extension MethodIsAncestor
Determines whether the given bone indices form a valid bone chain.
(Defined by SkeletonHelper.)
Public Extension MethodIsAncestorOrSelf
Determines whether the given bone indices form a valid bone chain.
(Defined by SkeletonHelper.)
Public Extension MethodResetBoneTransforms(Int32, Int32)Overloaded.
Resets the bone transforms of all bones in a bone chain.
(Defined by SkeletonHelper.)
Public Extension MethodResetBoneTransforms(Int32, Int32, Boolean, Boolean, Boolean)Overloaded.
Resets the bone transform components (scale, rotation or translation) of all bones in a bone chain.
(Defined by SkeletonHelper.)
Public Extension MethodResetBoneTransformsInSubtree
Resets the bone transform components (scale, rotation or translation) of all bones in a bone subtree.
(Defined by SkeletonHelper.)
Public Extension MethodRotateBoneAbsolute
Rotates a bone where the rotation is given in model space.
(Defined by SkeletonHelper.)
Public Extension MethodSetBonePoseAbsolute
Sets the bone transform to create a desired pose in model space.
(Defined by SkeletonHelper.)
Public Extension MethodSetBoneRotationAbsolute
Sets the bone rotation of a bone so that it matches the given rotation in model space.
(Defined by SkeletonHelper.)
Top
Properties
  NameDescription
Public propertyName
Gets or sets the name of the skeleton pose.
Public propertySkeleton
Gets the skeleton.
Public propertySkinningMatrices
Gets the skinning matrices.
Public propertySkinningMatricesXna
Gets the skinning matrices. (Only available in the XNA-compatible build.)
Top
Explicit Interface Implementations
  NameDescription
Explicit interface implementationPrivate methodIAnimatableObjectGetAnimatablePropertyT
Gets the property with given name and type which can be animated.
Explicit interface implementationPrivate methodIAnimatableObjectGetAnimatedProperties
Gets either the properties which are currently animated, or all properties which can be animated. (See remarks.)
Explicit interface implementationPrivate propertyIAnimatablePropertyAnimationValue
Gets the animation value.
Explicit interface implementationPrivate propertyIAnimatablePropertySkeletonPoseAnimationValue
Gets or sets the animation value.
Explicit interface implementationPrivate propertyIAnimatablePropertyBaseValue
Gets the base value.
Explicit interface implementationPrivate propertyIAnimatablePropertySkeletonPoseBaseValue
Gets the base value.
Explicit interface implementationPrivate propertyIAnimatablePropertyHasBaseValue
Gets a value indicating whether this property has a base value.
Explicit interface implementationPrivate propertyIAnimatablePropertyIsAnimated
Gets or sets a value indicating whether this property is animated by the animation system.
Top
Remarks

The Skeleton class defines a skeleton in bind pose. The SkeletonPose can be used to animate the bones of a skeleton. There are two ways to animate a skeleton using the animation system:

  • The skeleton pose implements the interface IAnimatableProperty<SkeletonPose>. This means that the skeleton pose can be treated as one animation value and can be animated as a whole. A skeleton pose can, for example, be animated using a SkeletonKeyFrameAnimation.
  • The skeleton pose also implements the interface IAnimatableObject. The bones of the skeleton pose are animatable properties. This means that the bones can be animated individually. For example, a SrtKeyFrameAnimation can be applied directly to a single bone.
You can find more details below.

Bone Transforms:
A bone transform is a local transformation that is applied to a bone. Bones are animated by changing the bone transforms (see GetBoneTransform(Int32) and SetBoneTransform(Int32, SrtTransform)). A bone transform is defined using a SrtTransform given in bone space. If a bone transform is the identity transformation (see Identity), then the bone is not animated and rendered in its bind pose.

Bone Poses:
A bone pose transformation matrix (bone pose) defines the resulting pose of bone after the bone transforms are applied. A bone pose describes the bone's position, orientation and scale relative to another coordinate space. A relative bone pose describes the pose of a bone relative to the parent bone (see GetBonePoseRelative(Int32)). An absolute bone pose describes the pose of a bone relative to model space (GetBonePoseAbsolute(Int32)).

The bone poses are computed and updated automatically: Whenever a bone transform is changed, the relative bone pose, absolute bone pose and the skinning matrices of the affected bone needs to be updated. Additionally, the absolute bone poses and the skinning matrices of all bones attached to this bone need to be updated as well. The skeleton pose automatically keeps track of which poses and matrices need to be recomputed. The recomputation is performed automatically as soon as one of these values is required.

To update all derived transformations at once, Update can be called.

IAnimatableProperty Implementation:
The class SkeletonPose implements the interface IAnimatableProperty<SkeletonPose> (see IAnimatablePropertyT). This means the SkeletonPose itself is an animatable property. It can be animated using any animation of type IAnimation<SkeletonPose>. Typically a SkeletonKeyFrameAnimation is used to animate the SkeletonPose. This is the most efficient way to animate a skeleton.

Note: The SkeletonPose as a IAnimatableProperty does not have a base value and therefore cannot be used in some from-to-by animations and similar animations that require a base value.

IAnimatableObject Implementation (For Advanced Uses Only!):
The class SkeletonPose additionally implements the interface IAnimatableObject. This means that the bones of the skeleton can also be animated independently. The animatable properties are the bone transforms given as IAnimatableProperty<SrtTransform>. The animatable properties can be accessed by calling the method GetAnimatablePropertyT(String) passing the name of the desired bone as the parameter. (Bones need to be named if they should be animated independently.)

For example, a SrtKeyFrameAnimation (or any other animation that implements IAnimation<SrtTransform>) can be applied directly to a bone.

Or, multiple SrtKeyFrameAnimations can be grouped together in a TimelineGroup. The animations can be assigned to different bones by setting the animation's TargetProperty to the name of the bone. The TimelineGroup can then be played as one animation.

Animating the SkeletonPose this way is very flexible - but slower than animating it with a single SkeletonKeyFrameAnimation.

Note: The IAnimatablePropertys of the individual bones do not have a base value and therefore cannot be used in some from-to-by animations or similar animations that require a base value.

Tip:
When bone transforms are manipulated regularly, e.g. in an IK solver, numerical errors can accumulate. If this happens and the skeleton seems to "explode", try to normalize the rotation quaternions regularly.

See Also