Pretty straight-forward. I have two Gameobjects, one is a Mesh and one is its children. The children is empty, located within the X, Y coordinates of the mesh but at an arbitrary Z axis. In the script where I create the object I also create a Plane pointing up, originating at the height the object is on.
planarObject = new GameObject("PlaneObject");
planarObject.transform.parent = meshObject.transform;
planarObject.transform.position = new Vector3 (_meshObject.transform.position.x, meshObject.transform.position.y, transform.position.z);
Plane plane = new Plane(Vector3.up, Vector3.Distance(planarObject.transform.position, Vector3.zero));
I want to create an EdgeCollision2D that runs along the points where the Plane intersects with the original mesh, which has its own Mesh Collider.
I appreciate the response, but I’m not trying to generate a mesh, this seems to be more complicated than the problem I have. I want the points on the surface of a mesh (already rendered with its own collider) that intersects with a plane, and then using those points to generate a 2D collider.
I was pointing out that the same techniques to boolean-intersect a large quad (analogous to your plane) with a mesh (which would compute you the contact line that you seek) likely apply to this problem.
Otherwise, try hacking it out with a series of equally-spaced raycasts, casting parallel to the plane in the direction of the mesh surface you wish to obtain, sort of like an elevation slice.