Geometry Scripting: Delete Sub Mesh

I am using the split mesh by sub components node to separate my dynamic mesh into several. My goal is then to delete some of the sub components. I tried to accomplish this by, in a for each loop, checking each dynamic mesh in the array for my deletion criteria, and if it meets the criteria I did a Get All Triangle IDs and passed the IDList and array element to a Delete Triangles From Mesh. I then use a branch node to check if the delete actually worked. The blueprint reports that the triangles are deleted, but the sub component is still visible on my screen. What is the correct way to approach deleting a sub component or all of its geometry via Geometry Scripting?

Maybe explaining a bit more about my goal would help. I am using realtime booleans to divide a wall in half. I have a function that compares the bounding box size of each sub mesh, and returns the biggest sub mesh. I then want to delete every mesh that is not the biggest mesh. I tried to expand on what is pictured by using the Is Empty node to confirm the mesh has no more geometry. And once again, the script confirms the mesh is empty. Yet, it is still on the screen. I am definitely missing some key concept.

Solution Found:
Rather than attempting to delete the other sub meshes, I used the Set Dynamic Mesh node of my Dynamic Mesh Component to set the dynamic mesh to only the mesh I wanted to keep. This forced the cleanup of the other sub meshes. To keep more than one element, use the Append Mesh node to merge all the meshes you want to keep into one piece, then set that as the New mesh slot in the Set Dynamic Mesh node.

1 Like