Make a Minecraft Water Sandbox
undefined

Here is the VoxelTables script you will be needing!

using System.Collections;
using System.Collections.Generic;
using Unity.Mathematics;
using UnityEngine;

public static class VoxelTables
{
    // all 8 possible vertices for a voxel
    public static readonly Vector3[] Vertices = new Vector3[8]
    {
        new Vector3(0.0f, 0.0f, 0.0f),
        new Vector3(1.0f, 0.0f, 0.0f),
        new Vector3(1.0f, 1.0f, 0.0f),
        new Vector3(0.0f, 1.0f, 0.0f),
        new Vector3(0.0f, 0.0f, 1.0f),
        new Vector3(1.0f, 0.0f, 1.0f),
        new Vector3(1.0f, 1.0f, 1.0f),
        new Vector3(0.0f, 1.0f, 1.0f),
    };

    // vertices to build a quad for each side of a voxel
    public static readonly int[,] QuadVerticesIndex = new int[6, 4]
    {
        // quad order
        // right, left, up, down, front, back

        // 0 1 2 2 1 3 <- triangle numbers

        // quads
        {1, 2, 5, 6}, // right quad
        {4, 7, 0, 3}, // left quad

        {3, 7, 2, 6}, // up quad
        {1, 5, 0, 4}, // down quad

        {5, 6, 4, 7}, // front quad
        {0, 3, 1, 2}, // back quad
    };

    // offset to neighboring voxel position
    public static readonly int3[] VoxelNeighborOffsets = new int3[6]
    {
            new int3( 1,  0,  0), // right
            new int3(-1,  0,  0), // left
            new int3( 0,  1,  0), // up
            new int3( 0, -1,  0), // down
            new int3( 0,  0,  1), // front
            new int3( 0,  0, -1), // back
    };
}