Adjusting vertices into shape

Hi! I’m not enough experienced in editing vertices.
I’m working on cutting tree.

My plan how to do it is in attached file “destruct tree.png”.
Problem is: I don’t know how to remove vertices like on image.

So, How I began:

void Update () {
    if (Input.GetMouseButtonDown(0)) {
        RaycastHit hit;
        if (Physics.Raycast(new Ray(transform.position, transform.forward), out hit)) {
            if (hit.transform.tag == "Tree") {
                Vector3 hitPos = hit.point - hit.transform.position;
                MeshFilter meshFilter = hit.transform.gameObject.GetComponent<MeshFilter>();
                Mesh mesh = meshFilter.mesh;

                List<Vector3> vertices = new List<Vector3>(mesh.vertices);

                Vector3 temp = Vector3.zero;
                float distance = 10000;

                foreach (Vector3 vec in vertices.Where(vec => Vector3.Distance(vec, hitPos) < distance)) {
                    temp = vec;
                    distance = Vector3.Distance(temp, hitPos);
                }

                //TODO: Find by index and then remove
                vertices.Remove(temp);
                mesh.vertices = vertices.ToArray();

                Debug.Log("NearTo " + hitPos + " is: " + temp + " -- DISTANCE: " + distance);
            }
        }
    }
}

What I’m trying to do:
Get vertices at position where is hit and then remove them.
Can anyone explain to me what I do wrong? Thanks. :slight_smile:

You probably don’t want to destroy a vertex, you either want to move it, so it has the not-a-least-bit-cliché cut in it, or you could set up an animation to do this for you, which would be more efficient, easier to produce, and would look nicer

I tried making mesh slicer while ago, but this version just duplicates the whole mesh,
and moves the “to be removed” vertices to the cutting plane position…

otherwise would need to fix the indices on the cut part,
so that the hole gets capped after removing vertices… which might get complicated.

There’s few mesh cutting / boolean scripts around for unity, that might work also…