• Runtimes
  • Start, Complete and End event

Related Discussions
...

Although I am using the unity runtimes, this is most likely more to do with the design of all the runtimes.

It seems I am very confused with the order of events with the latest runtime, as they have now changed.

Previously End event always fired before the Start event, However, now it seems, this isn't always the case. The First frame of a non blended animation plays before the end of the original animation

Image removed due to the lack of support for HTTPS. | Show Anyway

Here are the events in the order they happened at the time they happened. red ones are our keyed events (both in Runnning_light animation)

We start in idle, then walk to run. (all of which have a 0.2 mix ) . Which I guess is why they end 0.2 seconds after the anim which interrupted them.

Then from Run2 it gets interrupted into Running_Light, which has a blend time of 0 from run. After that starts and applies frame0, the run Ends.

Why does it end after Running_Light Starts?

Additionally if I let Running_Light complete, (and idle is in the queue) the sequence is this:

Image removed due to the lack of support for HTTPS. | Show Anyway


Running_Light > Idle mix is 0
Idle start is now after the end and complete event

However, If we interrupt running_light with walk we get the following (running_light>walk mix = 0)

Image removed due to the lack of support for HTTPS. | Show Anyway


Start happens before end.

...
To me it seems strange that if you interrupt an animation rather than queue one, events would fire in a different order

AnimationStateListener lists exactly when events occur. Unfortunately, this may be different from the old behavior, which was quite inconsistent. Note: interrupt means the animation is no longer current (it may still be applied for mixing), end means the animation will never be applied again (mixing is complete).

If you want to make an event log that makes what is happening clear, log only start, interrupt, and end events. As is, your event log is confusing and I can't tell why events fire in a different order. I can say the events are heavily tested and should be working as designed.

If you want to know when an animation is no longer current, you want to use the interrupt event. end is the wrong event for that. I believe in some cases end may need to be delayed a frame to give an animation a chance to apply one last time, eg to revert changes the animation had made back to the setup pose. This happens even if TrackEntry mixDuration is 0. It should not be important that end happens a bit later. Reasons to listen to end might be to disable particle effects or similar that began at start. However, if you don't want them active during the mixDuration, you'd want to disable them at interrupt.

Oh I see. I didn't realise there was an interrupt event, I think this is what we need. And reading about the end event makes sense and it seems the above behaviour I am seeing is correct.

I spent ages writing docs, my friend! :bang: :rofl:

it wasn't.

Our case for this is pretty simple, we fire an event at the start(maybe) of an animation to start rootmotion, we want root motion to happen in that animation until that animation is no longer playing, whether it completes or it gets interrupted.

We need the to know when before any transforms of the next animation are applied, and stop listening to the root then. (i.e. root moves back to 0,0 teleporting the player back to where rootmotion started). - we ignore all root blending and the root bone always has a alpha of 1 in the translateTimeline apply (this I believe handles rootmotion to rootmotion animations)


Nate escreveu

I spent ages writing docs, my friend! :bang: :rofl:

Documentation?

What is this you speak of, :smirk:


It seems interrupt and complete event is what I need. There should be a new event called stopped which fires on complete and interrupt ¯_(ツ)_/¯ , this would indicate the no more keys of this animation will be applied , not including mix.


it seems I was wrong, I need to store what trackentry starts rootmotion, and check on the end event if the end event belongs to that trackentry


or not...
maybe I should just do it on the start event


or not


oh, nevermind. I was doing a !=, not ==. On Complete and Interupt seem to be enough

Everything's going to be juuuust fiiiine... ::backs away slowly::