Get Neighbour of a Voxel

beginner faq

Voxel Play 3 · Troubleshooting & FAQ

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.