Always keep tokenSize/2 distance from walls

This commit is contained in:
Manuel Vögele
2022-02-02 10:36:03 +01:00
parent b55af992ec
commit 4d6543174a
3 changed files with 68 additions and 14 deletions
+3 -1
View File
@@ -18,8 +18,10 @@ export function isPathfindingEnabled() {
export function findPath(from, to, token, previousWaypoints) {
if (canvas.grid.type === CONST.GRID_TYPES.GRIDLESS) {
// TODO Store multiple pathfinders for different token sizes
let tokenSize = Math.max(token.data.width, token.data.height) * canvas.dimensions.size;
if (!gridlessPathfinder)
gridlessPathfinder = GridlessPathfinding.initialize(canvas.walls.placeables);
gridlessPathfinder = GridlessPathfinding.initialize(canvas.walls.placeables, tokenSize);
paintGridlessPathfindingDebug(gridlessPathfinder);
return GridlessPathfinding.findPath(gridlessPathfinder, from, to);
}