dimforge / dimforge/bevy_rapier

Feature request: ContactPairView::other_collider

Open
#215 2 comments 0 reactions 0 assignees View on GitHub
A-Integration C-Enhancement D-Easy good first issue P-Low S-not-started
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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.