Hi all,
I am trying to make a “Chunk” class which currently looks like this:
public class Chunk {
public GridCell[][][] chunkGridCells;
public Chunk(int chunkSize) {
chunkGridCells = new GridCell[chunkSize][chunkSize][chunkSize];
}
}
The class is supposed to be a holder for a 3d array of “GridCell” objects which look like this:
public class GridCell {
public Vector3[] cubePoints;
public double[] pointValues;
public int[] gridSpaceCoord;
public int cubeCellIndex;
public GridCell(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4, Vector3 p5, Vector3 p6, Vector3 p7, Vector3 p8, double v1, double v2, double v3, double v4, double v5, double v6, double v7, double v8, int gridSpaceX, int gridSpaceY, int gridSpaceZ) {
cubePoints = new Vector3[8];
cubePoints [0] = p1;
cubePoints [1] = p2;
cubePoints [2] = p3;
cubePoints [3] = p4;
cubePoints [4] = p5;
cubePoints [5] = p6;
cubePoints [6] = p7;
cubePoints [7] = p8;
pointValues = new double[8];
pointValues [0] = v1;
pointValues [1] = v2;
pointValues [2] = v3;
pointValues [4] = v5;
pointValues [5] = v6;
pointValues [6] = v7;
pointValues [7] = v8;
gridSpaceCoord = new int[3];
gridSpaceCoord [0] = gridSpaceX;
gridSpaceCoord [1] = gridSpaceY;
gridSpaceCoord [2] = gridSpaceZ;
cubeCellIndex = 0;
}
}
The “Cannot apply indexing…” error is thrown at the line inside of the “Chunk” constructor. I can’t seem to find the source of the error, but I have a feeling that I am missing something fairly basic. Thank you for any help you can give.