From d8e37f23639a0a8f4df07e7c2caa63a8b49e5b05 Mon Sep 17 00:00:00 2001 From: Andrew Gilewsky Date: Sat, 24 Feb 2024 20:16:41 +0000 Subject: [PATCH] More penalty tweaks smh. --- vnavmesh/NavVolume/VoxelSearch.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vnavmesh/NavVolume/VoxelSearch.cs b/vnavmesh/NavVolume/VoxelSearch.cs index 78706ae..6c358ec 100644 --- a/vnavmesh/NavVolume/VoxelSearch.cs +++ b/vnavmesh/NavVolume/VoxelSearch.cs @@ -24,8 +24,10 @@ public static int FindNearestEmptyVoxel(VoxelMap volume, Vector3 center, int hal if (!volume[x, y, z]) { var dist = (center - volume.VoxelToWorld(x, y, z)).Length(); + if (x != cv.x || z != cv.z) + dist += volume.CellSize.Y; // penalty for moving sideways vs up - TODO reconsider... if (y < cv.y) - dist += 2 * volume.CellSize.Y; // penalty for lower voxels to reduce chance of it being underground - todo reconsider.. + dist += 2 * volume.CellSize.Y; // penalty for lower voxels to reduce chance of it being underground - TODO reconsider... //Service.Log.Debug($"Considering {x}x{y}x{z}: {dist}, min so far {minDist}"); if (dist < minDist) {