Skip to content
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

animation triggers/events #15494

Open
atornity opened this issue Sep 28, 2024 · 0 comments · May be fixed by #15538
Open

animation triggers/events #15494

atornity opened this issue Sep 28, 2024 · 0 comments · May be fixed by #15538
Labels
A-Animation Make things move and change over time C-Feature A new feature, making something new possible D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it!

Comments

@atornity
Copy link
Contributor

atornity commented Sep 28, 2024

What problem does this solve or what need does it fill?

Being able to run arbitrary code at a defined point in time on an animation is sometimes really useful.

Example use case

  • spawn particles/sound effects every time a characters feet hits the ground in a walk animation.
  • a character is attacking, deal damage to nearby enemies after a delay.

What solution would you like?

I'd like a way to define "triggers" in an animations that executes a command or similar (event?), rather than animating some property.

something like:

#[derive(Event, Clone)]
enum Say {
    Hello,
    Bye,
}

fn say(trigger: Trigger<Say>) {
    match trigger.event() {
        Say::Hello => println!("Helloo!"),
        Say::Bye => println!("Bye!"),
    }
}

animation.trigger(1.0, Say::Hello); // can be any event type
animation.trigger(2.0, Say::Bye);

or maybe:

animation.add_triggers([1.0, 2.0], ["hello", "bye"]);

What alternative(s) have you considered?

You can get pretty far using Timers but it would take some effort to have it synced with an animation.

Additional context

Also seen in other engines such as unreal engine, unity and godot.

@atornity atornity added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Sep 28, 2024
@BenjaminBrienen BenjaminBrienen added A-Animation Make things move and change over time S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it! D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes and removed S-Needs-Triage This issue needs to be labelled labels Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Animation Make things move and change over time C-Feature A new feature, making something new possible D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants