FAQ |
Here is a collection of frequently asked questions, common problems and solutions.
This topic contains the following sections:
If AnimationClipTDuration is set to null, the clip plays only once and GetTotalDuration returns the actual duration. Often Duration is set to TimeSpan.MaxValue to repeat the animation forever. In this case GetTotalDuration also returns TimeSpan.MaxValue.
Other ways to get the duration:
There is no built-in way to get the length of a bone which has no child. Following methods could be used:
Per default, DigitalRune Animation uses the XNA content pipeline to import models. The XNA content pipeline has some limitations and not all exported 3D models work with it.
If you are using the XNA content pipeline, please test if your model works with the standard XNA Skinned Model Sample
If it does not work, please check the XNA forum for possible solutions.
If the model works with the XNA Skinned Model Sample, but it does not work with the DigitalRune Engine, please let us know and we will provide a fix.
Following animation class "wraps" a SkeletonPose. The current pose of the SkeletonPose property is copied to the value that should be animated.
using System; using DigitalRune.Animation; using DigitalRune.Animation.Character; using DigitalRune.Animation.Traits; namespace CharacterAnimationSample { // A custom SkeletonPose animation that simply "wraps" a SkeletonPose. The current pose // of the SkeletonPose property is copied to the SkeletonPose that should be animated. public class WrappedSkeletonPoseAnimation : Animation<SkeletonPose> { // The source SkeletonPose. public SkeletonPose SkeletonPose { get; set; } // Traits tell the animation system how to create/recycle/add/blend/etc. the animated // value type. Trait classes are usually singletons. public override IAnimationValueTraits<SkeletonPose> Traits { get { return SkeletonPoseTraits.Instance; } } // This animation goes on forever. public override TimeSpan GetTotalDuration() { return TimeSpan.MaxValue; } // Compute the animation value for the given time and stores it in result. protected override void GetValueCore(TimeSpan time, ref SkeletonPose defaultSource, ref SkeletonPose defaultTarget, ref SkeletonPose result) { var source = SkeletonPose ?? defaultSource; Traits.Copy(ref source, ref result); } } }