Closed jcornaz closed 2 years ago
As a User, I want an easy way to query for components of the entities involved in a collision, so that it is easier to read/update components as part of the reaction to the event.
Here is how usage could look like:
fn damage_system( mut event_reader: Local<EventReader<CollisionEvent>>, events: Res<Events<CollisionEvent>>, mut damageables: Query<&mut Hp>, bullets: Query<Bullet>, ) { event_reader.iter(events) .flat_map(|event| event.query(&mut damageables, &bullets)) .for_each(|(mut hp, bullet)| { hp.take_dmg(bullet.dmg()); }); }
Closing in favor of #207
As a User, I want an easy way to query for components of the entities involved in a collision, so that it is easier to read/update components as part of the reaction to the event.
Here is how usage could look like: