aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCrozet Sébastien <developer@crozet.re>2021-05-01 10:21:00 +0200
committerCrozet Sébastien <developer@crozet.re>2021-05-01 10:21:57 +0200
commitf350ac35d9889085af3f51a1894e2cc87173cb98 (patch)
tree76d50ec55022d7b2644701d63d697b1cb1099502 /src
parent2dfbd9ae92c139e306afc87994adac82489f30eb (diff)
downloadrapier-f350ac35d9889085af3f51a1894e2cc87173cb98.tar.gz
rapier-f350ac35d9889085af3f51a1894e2cc87173cb98.tar.bz2
rapier-f350ac35d9889085af3f51a1894e2cc87173cb98.zip
Fix crash in broad-phase after shape modification.
Fix #180 and #177
Diffstat (limited to 'src')
-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 {