Runtime Mesh Destruction in UE5

This project was another 5 week prototype for Advanced Technologies, and we were tasked to create a system for destroying a mesh at runtime. The system I developed could slice complex concave meshes using undirected graphs along with the Ear-Clipping algorithm.

The user can draw a line across the screen, analogous to a sword swing, which would then be turned into a plane. Using the plane, each triangle of the mesh is compared and moved depending on what side of the plane it is on. If the triangle intersected the plane, the intersection points on each edge are calculated and new vertices generated. These new vertices are then added to the undirected graph, and once all triangles of the mesh have been compared the undirected graph can be used to create the loops need for the Ear-Clipping algorithm. To find the loops, an arbitrary vertex on the graph is selected and using the neighbour of each vertex in the graph a loop is found when we arrive back at the starting vertex. If any vertices remain unvisited then the mesh must be concave and another loop can be found. These loops are then passed to the Ear-Clipping algorithm to create meshes to cover the holes created.

Below you can see a Torus sliced with this method.

Alt text