Simplify setup_scene_once_loaded in animated_fox#8999
Simplify setup_scene_once_loaded in animated_fox#8999mockersf merged 1 commit intobevyengine:mainfrom
Conversation
Why use a `done: Local<bool>` when `Added<AnimationPlayer>` works as well? It is more in line with what we'd usually do in bevy. An added advantage is that it is more useful as a starting point when implementing animations in your own game.
|
I'm happy to see updates in bevy animation crate :) Does this update also work if the two animations are completely different (different gltf files, mesh and animations)? How do you know the queried |
open the fold named Concerning the issue you mentioned, I've opened something similar: #8357 |
Sorry to disappoint, this is not an update in the bevy animation crate, just a change in the example.
It's already possible?
That's the hard part, you have to keep track of which gltf is loaded where and how it relates to the animation player component added, and it's not on the same entity but as one of its children. |
Objective
The setup code in
animated_foxuses adoneboolean to avoid running theplaylogic repetitively.It is a common pattern, but it just work with exactly one fox, and misses an even more common pattern.
When a user modifies the code to try it with several foxes, they are confused as to why it doesn't work (#8996).
Solution
The more common pattern is to use
Added<AnimationPlayer>as a query filter.This both reduces complexity and naturally extend the setup code to handle several foxes, added at any time.