Correctly offset shape when calculating whether it will collide at tile.

This commit is contained in:
Nolan Darilek 2022-06-15 10:28:00 -05:00
parent a019e8b5c7
commit eae03f8f7a

View File

@ -75,7 +75,7 @@ fn find_path_for_shape<D: 'static + Clone + Default + Send + Sync>(
if map.at(p.0 as usize, p.1 as usize).is_walkable() { if map.at(p.0 as usize, p.1 as usize).is_walkable() {
for tile in map.get_available_exits(p.0 as usize, p.1 as usize) { for tile in map.get_available_exits(p.0 as usize, p.1 as usize) {
let mut should_push = true; let mut should_push = true;
let shape_pos = Isometry2::new(Vector2::new(tile.0 as f32, tile.1 as f32), 0.); let shape_pos = Isometry2::new(Vector2::new(tile.0 as f32 + 0.5, tile.1 as f32 + 0.5), 0.);
query_pipeline.intersections_with_shape( query_pipeline.intersections_with_shape(
&collider_set, &collider_set,
&shape_pos, &shape_pos,