Excluding areas from rendering voxels

Modified on Sat, 10 Nov 2018 at 01:36 PM

Use the OnChunkBeforeCreate event to specify if a chunk can be rendered or not.


The following code produces an empty box centered at 0,100,0.


            env.OnChunkBeforeCreate += (Vector3 chunkCenter, out bool overrideDefaultContents, Voxel[] voxels, out bool isAboveSurface) => {
                Bounds exclusionBox = new Bounds();
                exclusionBox.center = new Vector3(0,100,0);
                exclusionBox.size = new Vector3(80,80,80);
                if (exclusionBox.Contains(chunkCenter)) {
                    overrideDefaultContents = true;
                } else {
                    overrideDefaultContents = false;
                }
                isAboveSurface = true;
            };

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article