Animations, AnimChannels and AnimEvents, oh my!

Can I get some authoritative answers regarding animations? I’ve read the documentation, the API, and some of the source, and a few things aren’t quite clear to me. I’ve tried experimenting, but I’d appreciate it if I could get some concrete information. Hopefully, the answers could benefit other users, too.

  • When blending two or more animations on the same channel, which animation is actually playing when the channel is queried? All of them? The most-recently started?

  • Take two animations, A and B. A is longer than B. I start animation A on a channel, then blend in B - animation A will start, then B will start, then B will finish, then A will finish. Which onAnimCycleDone will be broadcast?

  • If I blend with a blendTime of 0, do I get a onAnimCycleDone?

  • How do I stop an animation (and optionally return the bones to bind pose)? Will I get an onAnimCycleDone?

  • What does AnimChannel.reset(boolean) do? Will I get an onAnimCycleDone? It doesn’t look like it from the source, but I can’t easily tell.

  • What happens if a bone is controlled by more than one channel, and all those channels are animating it?

Thanks for any help!

1 Like
  1. the most recently started animation
  2. It doesn’t work like this. You’ll get the onAnimCycleDone for A as soon as you call channel.setAnim(“A”, blendTime). Then you’ll get B onAnimCycleDone when B is finished.
  3. Yes you will. Note that even when you use channel.setAnim(“blah”) there is a default blend time of 0.15 seconds.
  4. Channel.reset does that, but it sets the pose to the first frame

Sorry…i accidentally tabbed and submitted the post
4. it does 3 and should be documented, my bad, you won’t get a onanimCycleDone.
5. The last anim wins, meaning if you call channel1.setAnim(“A”), channel2.setAnim(“B”) and that both channel influence the same bone, the B animation will be played.

1 Like

Fantastic. Thank you very much!

One more question, if you could :

  • When I receive an onAnimCycleDone, how can I tell if the animation was ended early due to a blend, or reached the end of its cycle and terminated normally? Should I simply test AnimChannel.getTime() == AnimChannel.getAnimMaxTime()?

Yeah there are no built-in ways to do that. Not sure what you suggest would work though, because you may have the time of the new animation…like 0. Not 100% sure of this so it might be worth the try.

1 Like

Thanks for your help! I shall experiment over the next few days and (try to remember to) report back.

1 Like