This code is pretty simple, it grabs the bounding box of the mesh, and walks through it x,y,z by the size of one voxel cell, then it fires a ray cast in all 6 axes from each of those positions, if anything is hit, it instances a cube at the hit location.
Take all drawn lines, after they’re created store them in a list of vector lines
When the eraser is activated, search through all vector lines in the array, then iterate all points in the point arrays.
If the distance between the point and the mouse is less than some value then
check if the item index in the array is odd, if it is odd then set it to vector.zero.
then set the index – 1 to vector.zero.