import * as BABYLON from "babylonjs";

export function gridCellToWorld(grid, x, y, cellSize) {
    const halfW = (grid[0].length * cellSize) / 2;
    const halfH = (grid.length * cellSize) / 2;
    return new BABYLON.Vector3(
        x * cellSize - halfW + cellSize / 2,
        0,
        y * cellSize - halfH + cellSize / 2,
    );
}

export function isWalkableCell(grid, x, y) {
    return y >= 0 && y < grid.length && x >= 0 && x < grid[0].length && grid[y][x] === 0;
}
