Skip to content

2d Collision #2619

Answered by alice-i-cecile
AndrewCS149 asked this question in Q&A
Aug 7, 2021 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Here's a snippet from my draft of the next version of the Bevy book. In your case, ensuring the queries are mutually exclusive using a Without filter should do the trick.

Running multiple queries at once

As the logic in your systems become more complex, you may find that you want to access data from two different queries at once.
In most cases, simply adding a second query as another system parameter works perfectly fine:

fn defense_aura_system(aura_query: Query<&Transform, With<Aura>>, target_query: Query<(&mut Defense, &Transform), With<Creature>>){
	// Give all allies near an aura-generator a bonus to their defense
}

But as you use this pattern more, you may encounter an error that loo…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@AndrewCS149
Comment options

@AndrewJakubowicz
Comment options

Answer selected by AndrewCS149
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants