fix: remove goal standability check from provisional path
The is_standable_tile(goal) check was causing failures when goal position wasn't directly standable (common case). A* doesn't require goal to be standable - it finds the best path it can. Removed the check and return fallback single-point path when start isn't standable.
This commit is contained in:
@@ -585,13 +585,7 @@ pub fn calculate_provisional_path(
|
|||||||
LOCAL_FAILED_PATHS.with(|f| {
|
LOCAL_FAILED_PATHS.with(|f| {
|
||||||
*f.borrow_mut() += 1;
|
*f.borrow_mut() += 1;
|
||||||
});
|
});
|
||||||
return Vec::new();
|
return vec![Vec3::new(start.x as f32, start.y as f32, start.z as f32)];
|
||||||
}
|
|
||||||
if !is_standable_tile(tilemap, goal) {
|
|
||||||
LOCAL_FAILED_PATHS.with(|f| {
|
|
||||||
*f.borrow_mut() += 1;
|
|
||||||
});
|
|
||||||
return Vec::new();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let estimated_tiles = octile_distance_3d(start, goal) / ITILE_SIZE;
|
let estimated_tiles = octile_distance_3d(start, goal) / ITILE_SIZE;
|
||||||
|
|||||||
Reference in New Issue
Block a user