Start animation from specific frame
#2
Good question. Currently there is no easy way to do that.

But you can derive your own class from AssimpAnimationController and then override the GetFrameNumber to provide a custom frame number based on the animation time. This allows you to add an offset to the frame number. The following code shows an example:


Code:
public class MyAnimationController : AssimpAnimationController
{
    public double FrameNumberOffset { get; set; }

    public MyAnimationController(AssimpWpfImporter assimpWpfImporter)
        : base(assimpWpfImporter)
    {
    }

    public override double GetFrameNumber(double animationTimeInSeconds)
    {
        double frameNumber = base.GetFrameNumber(animationTimeInSeconds);

        frameNumber = (frameNumber + FrameNumberOffset) % LastFrameNumber;

        return frameNumber;
    }
}

// then start animation by:
_assimpAnimationController.FrameNumberOffset = startFrameNumber;
_assimpAnimationController.StartAnimation();



To provide an easier way to support that case in the future I have added an overload to the StartAnimation method that takes the start frame number as a parameter. This will be available in the next version.
Andrej Benedik
  


Messages In This Thread
Start animation from specific frame - by Alex3d - 01-03-2022, 04:39 PM
RE: Start animation from specific frame - by abenedik - 01-04-2022, 10:23 AM

Forum Jump:


Users browsing this thread:
1 Guest(s)