Pathfinding search

This commit is contained in:
2026-11-21 13:07:29 -03:00
parent e72932456a
commit 277664d2d9
5 changed files with 459 additions and 1 deletions
+2 -1
View File
@@ -212,7 +212,8 @@ export function box_is_free(
return !overlaps_solid(min, max, is_blocked);
}
function overlaps_solid(min: number[], max: number[], is_solid: BlockCollision) {
// whether the box between min and max (x, y, z) touches anything solid
export function overlaps_solid(min: number[], max: number[], is_solid: BlockCollision) {
for (let x = lowest(0, min[0]); x <= Math.floor(max[0] - EPSILON); x++) {
for (let y = lowest(1, min[1]); y <= Math.floor(max[1] - EPSILON); y++) {
for (let z = lowest(2, min[2]); z <= Math.floor(max[2] - EPSILON); z++) {