Open cha0s opened 2 years ago
Hi! I transferred this issue to the bevy_rapier
repository.
I believe this is a good addition. Please, feel free to open a PR. I suggest the implementation to look like this (return
isn’t really idiomatic in Rust):
pub fn other_collider(&self, entity: Entity) -> Option<Entity> {
if entity == self.collider1() { Some(self.collider2()) }
else if entity == self.collider2() { Some(self.collider1()) }
else { None }
}
(cargot fmt
will take care of formatting this properly).
Would bevy_rapier2d::geometry::CollidingEntities
component work for you?
https://docs.rs/bevy_rapier2d/latest/bevy_rapier2d/geometry/struct.CollidingEntities.html
Hi!
In the documentation I saw this example:
I thought that I'd suggest a method on
ContactPairView
;other_collider
Disclaimer: I'm just learning rust so this might be bad code. I'd appreciate any feedback.
Anyway, here's the idea code:
Thoughts? :)