aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Crozet <developer@crozet.re>2021-05-01 10:36:05 +0200
committerGitHub <noreply@github.com>2021-05-01 10:36:05 +0200
commit355f7a3a3934043a330763ca985264cdb1375405 (patch)
tree76d50ec55022d7b2644701d63d697b1cb1099502
parenta385efc5582c7918f11c01a2b6bf26a46919d3a0 (diff)
parentf350ac35d9889085af3f51a1894e2cc87173cb98 (diff)
downloadrapier-355f7a3a3934043a330763ca985264cdb1375405.tar.gz
rapier-355f7a3a3934043a330763ca985264cdb1375405.tar.bz2
rapier-355f7a3a3934043a330763ca985264cdb1375405.zip
Merge pull request #185 from dimforge/bf_bug
Fix crash in broad-phase after shape modification.
-rw-r--r--src/geometry/broad_phase_multi_sap/broad_phase.rs1
-rw-r--r--src/geometry/broad_phase_multi_sap/sap_region.rs6
2 files changed, 6 insertions, 1 deletions
diff --git a/src/geometry/broad_phase_multi_sap/broad_phase.rs b/src/geometry/broad_phase_multi_sap/broad_phase.rs
index 230d54d..4b35e53 100644
--- a/src/geometry/broad_phase_multi_sap/broad_phase.rs
+++ b/src/geometry/broad_phase_multi_sap/broad_phase.rs
@@ -369,6 +369,7 @@ impl BroadPhase {
// We need to promote the proxy to the bigger layer.
layer_id = self.ensure_layer_exists(new_layer_depth);
self.proxies[*proxy_index].layer_id = layer_id;
+ self.proxies[*proxy_index].layer_depth = new_layer_depth;
}
}
diff --git a/src/geometry/broad_phase_multi_sap/sap_region.rs b/src/geometry/broad_phase_multi_sap/sap_region.rs
index 40034c9..0778831 100644
--- a/src/geometry/broad_phase_multi_sap/sap_region.rs
+++ b/src/geometry/broad_phase_multi_sap/sap_region.rs
@@ -90,7 +90,11 @@ impl SAPRegion {
///
/// Returns `true` if this region contained the proxy. Returns `false` otherwise.
pub fn proper_proxy_moved_to_a_bigger_layer(&mut self, proxy_id: SAPProxyIndex) -> bool {
- if self.existing_proxies[proxy_id as usize] {
+ if self.existing_proxies.get(proxy_id as usize) == Some(true) {
+ // NOTE: we are just registering the fact that that proxy isn't a
+ // subproper proxy anymore. But it is still part of this region
+ // so we must not set `self.existing_proxies[proxy_id] = false`
+ // nor delete its endpoints.
self.subproper_proxy_count -= 1;
true
} else {