Fix pathfinding when target is slightly inside collider

This commit is contained in:
2024-02-13 13:09:52 +01:00
parent 1e20d307ea
commit 7d8dec5ef7

View File

@@ -192,7 +192,7 @@ bool pathfindAStar(const PathfindingDesc *desc) {
x < 0 || x >= map->width)
continue;
// not walkable
if (bzTileMapHasAnyCollision(map, x, y))
if (bzTileMapHasAnyCollision(map, x, y) && x != target.x && y != target.y)
continue;
PathNodeRecord *curRecord = &closedSet[y * map->width + x];
if (curRecord->visited)