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

Better tools for accessing multiple entities in Query iterables #1758

Closed
alice-i-cecile opened this issue Mar 25, 2021 · 2 comments
Closed
Labels
A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use

Comments

@alice-i-cecile
Copy link
Member

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.

@alice-i-cecile alice-i-cecile added the A-ECS Entities, components, systems, and events label Mar 25, 2021
@alice-i-cecile alice-i-cecile changed the title Better tools for accessing multiple entities in Queries Better tools for accessing multiple entities in Query iterables Mar 25, 2021
@alice-i-cecile alice-i-cecile added the C-Usability A targeted quality-of-life change that makes Bevy easier to use label Mar 25, 2021
@mockersf
Copy link
Member

mockersf commented Apr 3, 2021

related to #1763

@alice-i-cecile
Copy link
Member Author

Duplicate of #2042.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use
Projects
None yet
Development

No branches or pull requests

2 participants