-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Support for Triggering Events via AnimationEvent
s
#15538
base: main
Are you sure you want to change the base?
Add Support for Triggering Events via AnimationEvent
s
#15538
Conversation
The generated |
The generated |
rename events -> animation_events rename events -> animation_events
eda8fe2
to
d2ed656
Compare
Update bunny_detective.rs
it was too complicated
…tornity/bevy into animation-triggers-experiments
…tornity/bevy into animation-triggers-experiments
AnimationEvent
s
…tornity/bevy into animation-triggers-experiments
Objective
Add support for events that can be triggered from animation clips.
Closes #15494
Solution
Added a new field to
AnimationClip
:events
, which contains a list ofAnimationEvent
s. These are automatically triggered intrigger_events
.Note that there is currently no guarantee that events will be triggered in the correct order in instances were multiple events are triggered in the same update tick.Specifically, if the animation looped on this tick and there is one event at the start of the animation, and one event at the end of it, the event at the start will be triggered first simply because events are sorted by the time.
This could probably be accounted for somehow, not sure how though.
Fixed!
Testing
Added a couple of tests and examples to make sure events are triggered when expected.
Showcase
animation events can be added by specifying a
time
andevent
.and optionally, providing a target id.
Added two new animation examples,
animation_events
andbunny_detective
.The model is my own and it's CC0: https://opengameart.org/content/detective-bunny