Excluding Areas from Rendering

beginner faq

Voxel Play 3 · Troubleshooting & FAQ

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;
            };