Skip to content

Commit 2b42965

Browse files
committed
fix merge up error when move after merging up
1 parent 4bb6ffa commit 2b42965

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

bevy_quadtree/src/tree/tree_impl.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,11 @@ impl<const N: usize, const D: usize, const W: usize, const H: usize, const K: us
121121
let p = (id - 1) >> 2;
122122
if p > 0 {
123123
self.insert((p - 1) >> 2, entity, shape, changed, vec![p]);
124+
return;
124125
}
125126
}
127+
warn!("{:?} out of QuadTree boundary", entity);
128+
changed.push(Change::Leave(entity));
126129
}
127130
Relation::Disjoint | Relation::Overlap => {
128131
self.remove(id, &entity);
@@ -133,7 +136,7 @@ impl<const N: usize, const D: usize, const W: usize, const H: usize, const K: us
133136
Relation::Contained => match shape.detect(&self[id].inlet_boundary) {
134137
Relation::Disjoint | Relation::Overlap | Relation::Contain => {}
135138
Relation::Contained => {
136-
self.remove(id, &entity);
139+
self[id].entities.write().remove(&entity);
137140
self.insert(id, entity, shape, changed, vec![]);
138141
}
139142
},

0 commit comments

Comments
 (0)