Hello,
i have a quastion with a multidimensional array.
I’ll explain it a bit…
First i create my Array.
int[,,] voxel;
==================================================
Then i initialize it.
void Awake()
{
voxel = new int[16,16,16];
}
==================================================
Next thing is to fill it up with Zero’s.
void Start()
{
for(int x= 0; x < 16; x++)
{
for(int y = 0; y < 16; y++)
{
for(int z = 0; z < 16; z++)
{
voxel[x,y,z] = 0;
}
}
}
}
==================================================
After that i check if some of them are “1”.
void Update()
{
for(int x= 0; x < 16; x++)
{
for(int y = 0; y < 16; y++)
{
for(int z = 0; z < 16; z++)
{
if(voxel[x,y,z] == 1)
(
GenerateTriangleAtPosition(new Vector3(x,y,z))
)
else
(
DeleteTriangleAtPosition(new Vector3(x,y,z))
)
}
}
}
}
==================================================
So the problem is that i couldn’t enter higher values in the “voxel” Array like
voxel[11,13,2] = 1;
As they would never have been created…