Skip to content

Commit 976da67

Browse files
ContactPairView::colliderX return Option (#653)
* `ContactPairView::collider1` and `ContactPairView::collider2` now return an `Option`. * update changelog
1 parent 7ecb597 commit 976da67

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- Update from rapier `0.23` to rapier `0.24`,
1414
see [rapier's changelog](https://github.com/dimforge/rapier/blob/master/CHANGELOG.md).
1515
- `RapierContextInitialization::InitializeDefaultRapierContext` now has more fields for better control over default physics context.
16+
- `ContactPairView::collider1` and `ContactPairView::collider2` now return an `Option`.
1617

1718
## Fixed
1819

src/plugin/narrow_phase.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -347,17 +347,13 @@ pub struct ContactPairView<'a> {
347347

348348
impl ContactPairView<'_> {
349349
/// The first collider involved in this contact pair.
350-
pub fn collider1(&self) -> Entity {
351-
self.context_colliders
352-
.collider_entity(self.raw.collider1)
353-
.unwrap()
350+
pub fn collider1(&self) -> Option<Entity> {
351+
self.context_colliders.collider_entity(self.raw.collider1)
354352
}
355353

356354
/// The second collider involved in this contact pair.
357-
pub fn collider2(&self) -> Entity {
358-
self.context_colliders
359-
.collider_entity(self.raw.collider2)
360-
.unwrap()
355+
pub fn collider2(&self) -> Option<Entity> {
356+
self.context_colliders.collider_entity(self.raw.collider2)
361357
}
362358

363359
/// The number of contact manifolds detected for this contact pair.

0 commit comments

Comments
 (0)