I’m not sure if this is the right place to post this so I apologize in advance if it is not. Anywho, I am currently working on a 3d voxel game, I know “Not another minecraft clone!!”, but i assure you its not, i have my own ideas for this game it is just voxel, minecraft was not the first, nor will it be the last. I was just wondering if it were possible to create an array of voxels with prefabed cubes, instead of just generating faces, i was working with a script to generate faces and i could not get it to work properly, with mining with drills, for stone blocks, shovel for dirt and gravel and sand, or axes/chainsaws for wood. so i was wondering if i could just have all of the code for mining in the block itself, like mine speed, and what not, and create an array with those cubes. Thank you all for the help
If each cube is an instance of a prefab, then a 100x100x100 world will already make your Unity scream in pain as if you were forcing a whale under the nails of its toes. So yes, you can use an array of blocks, but you’d better get really creative in how to reduce the amount of game objects in the world.
Ahh okay i gotcha I I got The other way to work for a short period and now im having one error, in my script to add and remove blocks
public void UpdateChunkAt(int x, int y, int z){
int updateX= Mathf.FloorToInt( x/world.chunkSize);
int updateY= Mathf.FloorToInt( y/world.chunkSize);
int updateZ= Mathf.FloorToInt( z/world.chunkSize);
print("Updating: " + updateX + ", " + updateY + ", " + updateZ);
world.chunks[updateX,updateY, updateZ].update=true();
if(x-(world.chunkSize*updateX)==0 && updateX!=0){
world.chunks[updateX-1,updateY, updateZ].update=true;
}
if(x-(world.chunkSize*updateX)==15 && updateX!=world.chunks.GetLength(0)-1){
world.chunks[updateX+1,updateY, updateZ].update=true;
}
if(y-(world.chunkSize*updateY)==0 && updateY!=0){
world.chunks[updateX,updateY-1, updateZ].update=true;
}
if(y-(world.chunkSize*updateY)==15 && updateY!=world.chunks.GetLength(1)-1){
world.chunks[updateX,updateY+1, updateZ].update=true;
}
if(z-(world.chunkSize*updateZ)==0 && updateZ!=0){
world.chunks[updateX,updateY, updateZ-1].update=true;
}
if(z-(world.chunkSize*updateZ)==15 && updateZ!=world.chunks.GetLength(2)-1){
world.chunks[updateX,updateY, updateZ+1].update=true;
}
}
in the world.chunks[updateX, updateY, updateZ].update=true(); im getting an error saying " Expression denotes a value', where a
method group’ was expected"
Sorry again, i removed the () at the end and now it all works.I feel like an idiot