How to get the neighbour of a voxel?

Modified on Wed, 03 Aug 2022 at 08:07 AM

Using the API, call this method:


public bool GetVoxelIndex (VoxelChunk chunk, int voxelIndex, int offsetX, int offsetY, int offsetZ, out VoxelChunk otherChunk, out int otherVoxelIndex, bool createChunkIfNotExists = false)


For example, to get the right neighbour of a voxel, pass the chunk and voxelIndex value of that voxel and offsetX = 1. The method will provide the chunk and voxelIndex of the neighbour voxel in otherChunk and otherVoxelIndex return parameters.


Use "createChunkIfNotExists" to force the creation of a chunk if it doesn't exist at the time of calling this method.


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