SkeletonPose Class |
Namespace: DigitalRune.Animation.Character
The SkeletonPose type exposes the following members.
Name | Description | |
---|---|---|
Clone |
Creates a new SkeletonPose that is a clone (deep copy) of the current
instance.
| |
Create |
Creates an instance of the SkeletonPose class. (This method
reuses a previously recycled instance or allocates a new instance if necessary.)
| |
Equals | (Inherited from Object.) | |
GetBonePoseAbsolute |
Gets the absolute bone pose of the specified bone.
| |
GetBonePoseRelative |
Gets the relative bone pose of the specified bone.
| |
GetBoneTransform |
Gets the bone transform of the specified bone.
| |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
Recycle |
Recycles this instance of the SkeletonPose class.
| |
ResetBoneTransform |
Resets the bone transforms of the specified bone.
| |
ResetBoneTransforms |
Resets the bone transforms of all bones in the skeleton.
| |
SetBoneTransform |
Sets the bone transform of the specified bone.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
Update |
Updates all bone transformations.
|
Name | Description | |
---|---|---|
DrawBones |
Draws the skeleton bones, bone space axes and bone names for debugging.
(Only available in the XNA-compatible build.)
(Defined by SkeletonHelper.) | |
GetChain |
Gets the bone indices of a bone chain.
(Defined by SkeletonHelper.) | |
GetNumberOfBones |
Counts the number of bones in a bone chain.
(Defined by SkeletonHelper.) | |
IsAncestor |
Determines whether the given bone indices form a valid bone chain.
(Defined by SkeletonHelper.) | |
IsAncestorOrSelf |
Determines whether the given bone indices form a valid bone chain.
(Defined by SkeletonHelper.) | |
ResetBoneTransforms(Int32, Int32) | Overloaded.
Resets the bone transforms of all bones in a bone chain.
(Defined by SkeletonHelper.) | |
ResetBoneTransforms(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.) | |
ResetBoneTransformsInSubtree |
Resets the bone transform components (scale, rotation or translation) of all bones in a
bone subtree.
(Defined by SkeletonHelper.) | |
RotateBoneAbsolute |
Rotates a bone where the rotation is given in model space.
(Defined by SkeletonHelper.) | |
SetBonePoseAbsolute |
Sets the bone transform to create a desired pose in model space.
(Defined by SkeletonHelper.) | |
SetBoneRotationAbsolute |
Sets the bone rotation of a bone so that it matches the given rotation in model space.
(Defined by SkeletonHelper.) |
Name | Description | |
---|---|---|
Name |
Gets or sets the name of the skeleton pose.
| |
Skeleton |
Gets the skeleton.
| |
SkinningMatrices |
Gets the skinning matrices.
| |
SkinningMatricesXna |
Gets the skinning matrices. (Only available in the XNA-compatible build.)
|
Name | Description | |
---|---|---|
IAnimatableObjectGetAnimatablePropertyT |
Gets the property with given name and type which can be animated.
| |
IAnimatableObjectGetAnimatedProperties |
Gets either the properties which are currently animated, or all properties which can be
animated. (See remarks.)
| |
IAnimatablePropertyAnimationValue |
Gets the animation value.
| |
IAnimatablePropertySkeletonPoseAnimationValue |
Gets or sets the animation value.
| |
IAnimatablePropertyBaseValue |
Gets the base value.
| |
IAnimatablePropertySkeletonPoseBaseValue |
Gets the base value.
| |
IAnimatablePropertyHasBaseValue |
Gets a value indicating whether this property has a base value.
| |
IAnimatablePropertyIsAnimated |
Gets or sets a value indicating whether this property is animated by the animation system.
|
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:
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.