This project shows how to use Scriptable Tools and DynamicMesh to easily create body parts for a Gore system.

How it works
You need a DynamicMesh Actor.
This actor is given a function called “CutMeshByBone”. What we are doing here is quite simple.
As we have a variable “CutBone” on this bone we want to cut the mesh. Now we create an array with all ChildBones. Now we can go through all vertieces and see if the vertex is skinned at one of the bones. Then we create a selection, invert it and delete everything.
That’s all!
Unfortunately there is one problem: it can happen that your mesh has too many vertices and you get an “Infinity Loop Detected”. If this is the case, you must increase the following value in your project settings:
Project Settings -> Engine -> General Settings -> Max Loop Iteration Count.
For the Boolean operation we need a second DynamicMesh. To create a Boolean operation, we simply use the “Apply Mesh Boolean” method.

To save the mesh, the DynamicMesh component has the “Copy Mesh to Static Mesh” and “Copy Mesh to Skeletal Mesh” methods.


Unreal Scriptable Tools
The scriptable tool works as follows: when the tool is started, it checks whether the first selected actor is a skeletal mesh.
if it is, it is hidden and a DynamicMeshActor is spawned in its place. When the tool closes, DynamicMeshActor is destroyed and the original mesh is displayed.
We simply use the methods from our DynamicMeshActor and execute them when the button is clicked.
We use the Gizmo Transform method to move our brush.

Since saving the mesh requires a StaticMesh or a SkeletalMesh. We simply copy these to the right place.



