• Runtimes
  • Mixing skeleton Pose with new animation

  • تم التحرير
Related Discussions
...

In the game I'm currently developing I've come across situations where the player finishes an animation and has to maintain his pose on that animation's last frame. After a while he shoots another animation which i would need to mix with the current pose (given the animation ended a while ago). So i was wondering if there was any way I could mix a new animation with the current skeleton pose instead of a previous animation.

My current idea would be to somehow access the bones/slots information from the new animation and in a buffer state interpolate my current pose with that information. Once it finishes I would run the new animation.

Any ideas? Am I going about this right? Thanks!

When an animation is applied it overwrites all the bones' SRT. Storing them all so you can apply them, then another animation would be a pain. Instead, just apply the old animation with a time >= the last keyframe. The easiest way to do this is to set the duration on the animation to something high, like int max or 9999. Then use AnimationState to do the mixing.

firstAnim.duration = 9999;
state.setAnimation(0, firstAnim, false);
state.addAnimation(0, secondAnim, false, 2); // Need to set delay, can't use 0.

The delay has to be set for the queued animation, can't use zero which would try to use the first animations duration as the delay.

Thanks i'll give it a try.