Skip to content

Commit

Permalink
fix inserting same object in spatial_map wouldn't remove old handle f…
Browse files Browse the repository at this point in the history
…rom broad
  • Loading branch information
Uriopass committed Jan 16, 2024
1 parent 15e6ad1 commit fb45db9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion simulation/src/map/spatial_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ impl SpatialMap {
let kind = kind.into();
let shape = shape.into();
let handle = self.broad.insert(shape.bbox(), kind);
self.ids.insert(kind, handle);
if let Some(old_handle) = self.ids.insert(kind, handle) {
self.broad.remove(old_handle);
}
self.near.insert(kind, shape);
}

Expand Down

0 comments on commit fb45db9

Please sign in to comment.