This is a pretty simple question, but I havent used c# in a while so I'm a bit rusty.
struct Voxel
{
Vector3 Position;
enum VoxelType
{
air = 0,
grass = 1
};
}
This is how I'm going to create the voxel data structure.
for (int x = 0; x < CHUNKSIZE; x++)
{
for (int y = 0; y < CHUNKSIZE; y++)
{
for (int z = 0; z < CHUNKSIZE; z++)
{
ChunkArray[x, y, z] = new Voxel();
}
}
}
I populate my ChunkArray with voxel structures. My question is, how do I set the Voxel Position variable using the x, y, and z variables?
Voxel[,,] ChunkArray = new Voxel[32, 32, 32];
Edit:
I think I solved my problem...
ChunkArray[x, y, z] = new Voxel
{
Position = new Vector3(x, y, z),
};