Fix pathfinding when target is slightly inside collider
This commit is contained in:
@@ -192,7 +192,7 @@ bool pathfindAStar(const PathfindingDesc *desc) {
|
|||||||
x < 0 || x >= map->width)
|
x < 0 || x >= map->width)
|
||||||
continue;
|
continue;
|
||||||
// not walkable
|
// not walkable
|
||||||
if (bzTileMapHasAnyCollision(map, x, y))
|
if (bzTileMapHasAnyCollision(map, x, y) && x != target.x && y != target.y)
|
||||||
continue;
|
continue;
|
||||||
PathNodeRecord *curRecord = &closedSet[y * map->width + x];
|
PathNodeRecord *curRecord = &closedSet[y * map->width + x];
|
||||||
if (curRecord->visited)
|
if (curRecord->visited)
|
||||||
|
|||||||
Reference in New Issue
Block a user