![]() # Objective Improve the performance of animation. `animate_targets` only does work for entities with a `AnimationTarget` component, but the query it uses has no filters and matches all archetypes, resulting in extra work checking and ignoring every other entity in the world. In addition, it uses `EntityMutExcept::get`, which has to look up the `ComponentId` for `AnimationTarget` each time it's used. Fixes #15412 ## Solution Instead of `entity_mut.get::<AnimationTarget>()`, add `&AnimationTarget` to the query and read it directly. This requires adding `AnimationTarget` to the list of exceptions in the `EntityMutExcept`. Since the resulting type is getting long, add an alias for it. This does mean that `AnimationTarget` is no longer available through `entity`, which means it's not possible to animate the `AnimationTarget` component itself. ## Testing I ran performance traces of many_foxes comparing this branch to main. Red is main, yellow is these changes:  |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
README.md |