I’ve been working on a character dismemberment system for a while now and it’s working pretty well except there’s a small problem. Before I go into it I’m going to shortly explain how my setup works:
I have a character that is divided into 7 parts: head, torso, pelvis, arms and legs. Each of these parts are skinned to a single skeleton. I export each part invidualy and combine them inside a character blueprint making the pelvis part a base (putting it into Mesh component) and rest as skinned mesh components under the pelvis. Pelvis component has a full body physics asset (all bones have collision spheres) and the rest have physics collisions that only cover the part the mesh is skinned to (for example head physics asset only have collision on head and neck bones). Each component has collision set to Ragdoll. Then in construction graph I set the pelvis as a master pose component for all the child objects (torso, head, arms and legs.) This seems to work perfectly and the character animates properly.
I’m trying to make the dismemberment part to work by detaching one of the skinned mesh elements, then setting simulate physics on for it. Here’s the graph:
However this crashes UE4. If I remove collisions from the detached component the crash doesn’t happen, but then the detached part doesn’t work as intended. I can also leave the collision on and remove the part from construction script that sets master pose component for the detachable object and it works, but the detachable object doesn’t animate properly (as it doesn’t follow the pelvis anymore). Knowing this I tried a different approach where I would set the master pose component to null before detaching and applying physics. Here’s the graph:
This almost works but when the part is detached it “teleports” to a world coordinates where the character first spawned (or the place where the master pose component was first set.) I managed to find a way around this by adding delay between setting the master pose component null and detaching the skinned mesh component, but this really doesn’t work 100% of the time. I can only assume it’s somehow related to “physic ticks” not being in sync with “normal game ticks”. Here’s my final graph (which works, but is really a duct tape workaround):
So my questions are:
A) How would I make the current system work properly?
B) Should I completely rethink the way the dismemberment system works currently?
Thanks in advance!