How to get pending animation events and manually trigger them

Not sure if this is a feature request or question, since I may have missed an existing feature. So I posted it under questions.

The current expected usage of animation event is like callback style:

  1. Register animation event on certain keyframe
  2. RuntimeAnimation will trigger the callback function when:
  • current animation frame is larger than the registered keyframe and
  • the event is not marked “done”

However, I found it difficult when mixing animation events with FSM state changing.
There are currently 2 ways i could think of to achieve:

  1. Animation event directly changes FSM state, but it makes things harder to debug how and when the state changed.
  2. Animation event tells what action is triggered by caching the event type and payload somewhere. On next update loop, the FSM reads the events triggered and perform state changes. This approach however make things happen 1 step later and produce slightly laggy response, which is my current workaround.

It would be perfect if there is a way to disable auto triggering animation events, manually get pending animation events and mark them as “done”.
Or maybe get how many frames elapsed for the current step just like how animation events are handled.

Any help is appreciated.

cc @Deltakosh

I think i understand what you need but I do not get the overall goal. Do you have a way to reproduce what you would like to get in the playground?

Technically I see no problem to have a tool to disengage AnimationEvents but then why do you want them? Why not managing them by yourself outside?. And checking on each frame where is each animation

Please help me understand the overall plan :slight_smile:

You are right. After trying to create a playground, I could have just keep track of the current frame of animation and what events are triggered outside. :sweat_smile:

Animation event → FSM read flag:

FSM read current frame:

1 Like