dimforge / dimforge/bevy_rapier
Feature request: ContactPairView::other_collider
- Dominant language
- Rust
- Stars
- 1.6k
- Forks
- 282
- PR merge metrics
- No merged PRs in 30d
Description
Hi!
In the documentation I saw this example:
```rust
let other_collider = if contact_pair.collider1() == entity {
contact_pair.collider2()
} else {
contact_pair.collider1()
};
```
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:
```rust
impl<'a> ContactPairView<'a> {
...
pub fn other_collider(&self, entity: Entity) -> Option {
if entity == self.collider1() { return Some(self.collider2()); };
if entity == self.collider2() { return Some(self.collider1()); };
None
}
}
```
Thoughts? :)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.