diff --git a/src/pathfinding.rs b/src/pathfinding.rs index b36722c..6770ef0 100644 --- a/src/pathfinding.rs +++ b/src/pathfinding.rs @@ -139,13 +139,9 @@ fn calculate_path( let map_clone = map.clone(); let handle_clone = *handle; let mut collider_set = rapier_context.colliders.clone(); - let obstructions = obstructions - .iter() - .map(|v| v.0) - .collect::>(); let mut to_remove = vec![]; for handle in collider_set.iter() { - if !obstructions.contains(&handle.0) { + if !obstructions.iter().map(|v| v.0).any(|x| x == handle.0) { to_remove.push(handle.0); } }