More tolerant pathfinding

This commit is contained in:
Joshua Barretto
2020-07-03 20:30:21 +01:00
committed by jshipsey
parent db26c10299
commit 177bd7a128
5 changed files with 13 additions and 6 deletions

View File

@ -266,7 +266,10 @@ where
.map(move |(dir, _)| pos + *dir),
)
};
let transition = |_: &Vec3<i32>, _: &Vec3<i32>| 1.0;
let transition = |a: &Vec3<i32>, b: &Vec3<i32>| {
((*a - *b) * Vec3::new(1, 1, 3)).map(|e| e.abs()).reduce_max() as f32
+ endf.distance((*b).map(|e| e as f32)) * 0.01
};
let satisfied = |pos: &Vec3<i32>| pos == &end;
let mut new_astar = match astar.take() {