Quantcast
Channel: Questions in topic: "chunks"
Viewing all articles
Browse latest Browse all 165

Access a multidimensional array inside an array

$
0
0
Hey all, I am working on a voxel engine and I have an array of chunks, which is actually just a 4dimensional array of blocks. The first index in the array is a chunk index and the rest are the x, y and z indexes of the blocks inside the chunks. Now I would like to loop through all the chunk indexes and pass the 3 dimensional array inside the chunks to a method, but it gives me an error. Here is an example: Block[,,,] blockData = new Block[chunkIndexes.Length, chunkSizeX, chunkSizeY, chunkSizeZ]; for (int i = 0; i < chunkIndexes.Length; ++i) { // Here I would like to pass the 3dimensional array to a method but it gives // me an error saying that blockData requires 4 indexes. DoSomeyhingWithTheChunk(blockData[i]); } I want to avoid using a List or something like that, does anyone know how i can achieve passing the 3dimensional arrays to a method?

Viewing all articles
Browse latest Browse all 165

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>