Better tools for accessing multiple entities in Query iterables #1758
Labels
A-ECS
Entities, components, systems, and events
C-Usability
A targeted quality-of-life change that makes Bevy easier to use
What problem does this solve or what need does it fill?
Within a mutable query iteration, we can't access more than one entity at a time, because of the borrow checker. This is frustrating when trying to do things like write your own collision detection or handling other entity-entity interactions.
What solution would you like?
Provide a Bevy-native tool (with a simple game example) to allow careful mutable access to more than one entity within a loop.
Here's some initial discussion of what that might look like.
What alternative(s) have you considered?
Fully solving #1631 would allow us to use iter_tools directly for this sort of thing, but Clone on mutable queries is probably a hard no.
As a workaround, you can record which entities you need to access, then use
query.get()
to pull out their components separately. This is not super obvious and very cumbersome.Additional context
First raised on Discord.
The text was updated successfully, but these errors were encountered: