Development Blog 6 - Physical Simulation Part 2

Even if some minor adjustments are still needed and the setup has many limitations, what I was trying to achieve, has been achieved. I'll describe how this work as closely as possible. I want to use this simulation as a core mechanic of my game, so I created an infrastructure that allow me to reproduce the simulation on any character in the game, yet is currently very dirty and written in blueprints, so I will explain only the Unreal Engine 4 Components, it's better you adapt your game as it best fits.

I'll perfect this in the future, for now, it works well enough for me.

There are many limits with the setup, those are not a problem for the game I'm trying to achieve, but you can expand to correct such problems:
-each part of the body is represented by a mesh and a destructible mesh (DM).
-the meshes cannot be stretched/animated, so it's not possible to have animated hands, as DM cannot be animated, they are created by static meshes.
-the workflow is very long, each arm/leg/head of the characters is composed of a single meshes attached to the bones of the skeleton.

The workflow is as follow:
1- In Blender, I create the rig with a simple mesh as a reference.
2- I create all the animations.
3- Then I create all the meshes to attaches to the single bones
4- Export skeleton and all the meshes in UE4.
5- For each Mesh I create a Destructible Mesh (be sure to import the apex plugin).
6- Set up all the DM as needed, the key setting is Support Depth to 1, Enable Impact Damage to True and a custom Damage Threshold and Damage Cap and everything else as needed.
7- Now, in the game, I use a Physical Animated Mesh to create the ragdoll of the characters. Be sure to use the tool to generate the bodies and constraints, custom modification looks to be broken and needs a long time to be set up too.
8- When a body (like the arm) of the mesh is hit, I break the constraint of that body to detach it from the skeleton.
9- Here the magic happens: I remove the mesh attached to the body that was hit and I spawn a DM in the exact place, the DM get immediately hit by the sword and is destroyed!

Here's an example: if I the head of the character is a blueprint attached to a skeleton, the blueprint has the mesh of the head. When the head of the skeleton is hit by the sword, I destroy the Blueprint attached to the head socket and I spawn the head DM in the same position.
I hope it makes sense, contact me on Twitter if you want to try this and you need help!