diff options
| author | Crozet Sébastien <developer@crozet.re> | 2021-06-08 18:05:01 +0200 |
|---|---|---|
| committer | Sébastien Crozet <sebastien@crozet.re> | 2021-06-08 18:23:40 +0200 |
| commit | ff6c75f3bd6d045cc5ca2cafc2d00971a8f15530 (patch) | |
| tree | 654d94d58fe057be024b1e4bee0afe33169fa4eb /src/geometry | |
| parent | bccb7d4c669fb3bafa94d90486fa4d9b78f88cf8 (diff) | |
| download | rapier-ff6c75f3bd6d045cc5ca2cafc2d00971a8f15530.tar.gz rapier-ff6c75f3bd6d045cc5ca2cafc2d00971a8f15530.tar.bz2 rapier-ff6c75f3bd6d045cc5ca2cafc2d00971a8f15530.zip | |
Fix collider removal from narrow-phase when the same collider is listed twice.
Diffstat (limited to 'src/geometry')
| -rw-r--r-- | src/geometry/narrow_phase.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/geometry/narrow_phase.rs b/src/geometry/narrow_phase.rs index 185cf0c..bbabc95 100644 --- a/src/geometry/narrow_phase.rs +++ b/src/geometry/narrow_phase.rs @@ -270,7 +270,10 @@ impl NarrowPhase { for collider in removed_colliders { // NOTE: if the collider does not have any graph indices currently, there is nothing // to remove in the narrow-phase for this collider. - if let Some(graph_idx) = self.graph_indices.get(collider.0) { + if let Some(graph_idx) = self + .graph_indices + .remove(collider.0, ColliderGraphIndices::invalid()) + { let intersection_graph_id = prox_id_remap .get(collider) .copied() @@ -330,6 +333,10 @@ impl NarrowPhase { replacement.intersection_graph_index = intersection_graph_id; } else { prox_id_remap.insert(replacement, intersection_graph_id); + // I feel like this should never happen now that the narrow-phase is the one owning + // the graph_indices. Let's put an unreachable in there and see if anybody still manages + // to reach it. If nobody does, we will remove this. + unreachable!(); } } @@ -338,6 +345,10 @@ impl NarrowPhase { replacement.contact_graph_index = contact_graph_id; } else { contact_id_remap.insert(replacement, contact_graph_id); + // I feel like this should never happen now that the narrow-phase is the one owning + // the graph_indices. Let's put an unreachable in there and see if anybody still manages + // to reach it. If nobody does, we will remove this. + unreachable!(); } } } |
