public PlaningGrid(Vector3[] boundary, float cellGap = 6, float h = 1) { cells = new List <PlaningGridCell>(); height = h; BoundingBox bbox = BoundingBox.CreateFromPoints(boundary); countW = (int)(Mathf.Round(bbox.size[0] / cellGap)); countD = (int)(Mathf.Round(bbox.size[2] / cellGap)); for (int i = 0; i < countD; i++) { for (int j = 0; j < countW; j++) { float skip = 0; //float skip = (j % 2) * cellSize; Vector3 pos = new Vector3((j * cellGap) + skip, height, i * cellGap); pos += bbox.position; PlaningGridCell cell = PlaningGridCell.CreateCell(pos, 0.1f); cells.Add(cell); } } }
public static PlaningGridCell CreateCell() { return(PlaningGridCell.CreateCell(Vector3.zero, 2)); }