Closed n0q closed 1 year ago
For what it's worth, this has done well as a hacky temporary workaround.
const movedToken = tokens[0];
const moveHistory = foundry.utils.duplicate(getMovementHistory(movedToken));
moveHistory.push(movedToken.center);
const rays = [];
for (let i = 0; i < moveHistory.length -1; i++) {
rays.push({ray: new Ray(moveHistory[i], moveHistory[i+1])});
}
const distances = game.canvas.grid.measureDistances(rays, {gridSpaces: true});
const moved = distances.reduce((sum, a) => sum + a, 0);
dragRuler.getMovedDistanceFromToken()
only seems to work correctly on gridded scenes. Without a grid, results are somewhat consistent, but seemingly very wrong. Moving east or south by 5 feet measures something close to 3.5, while west or north is more like 7.9.