Hello I’m pretty new to unity and i have a problem with the placement of 2d sprites… Im trying to create a isometric grid and it kinda works, but the gaps between the cells is way to big. Here the code i use:
void CreateGrid()
{
grid = new GridCell[(int)size.x,(int)size.y];
for (int ix = 0; ix < (int)size.x; ++ix)
{
for (int iy = 0; iy < (int)size.y; ++iy)
{
float cell_x = ((ix - iy) * (GridCell.CELL_WIDTH / 2)); // CELL_WIDTH = 128
float cell_y = ((ix + iy) * (GridCell.CELL_HEIGHT / 2)); // CELL_HEIGHT = 64
float cell_z = 0;
Vector3 position = new Vector3(cell_x, cell_y, cell_z);
GridCell cell = Instantiate(gridCell, position, Quaternion.identity);
grid[ix, iy] = cell;
}
}
}
My Goal is to get a grid without gaps, that still could be used in world space…