Dig holes in the object

Now I have two objects, A and B generated by myself. I want to dig a hole in object B, according to the projection of object A.

I mean, like this :laughing: :
wall

What should I do? Can I do it in C#? :thinking:
Thanks for your help.

I guess the way to do it is :thinking: :

  1. Get the object surface point set:
Mesh mesh = this.gameObject.GetComponent<MeshFilter>().mesh;
Vector3[] vertices = mesh.vertices;
  1. Project all the points onto the “wall”:
Vecotr3.ProjectOnPlane()
  1. Get the area that should be clipped, that is, the circumscribed polygon of these mapped point set:

Ramer–Douglas–Peucker algorithm

Do you think this is possible? :laughing: