Download

Character Dismemberment System, Almost There

Hey,

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:
8d35d5bf3a8ec714ee33eacd5b74553c891caaa0.png

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:
7fd0bc9010d412b8fd50a99f5a58cbb0368a0881.png

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):
49c4b1739ad57738697bdbea0c184dc12d8ed325.png

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? :slight_smile:

Thanks in advance!

-Irmstoi

Have you tried detaching first and simulating afterwards? Also you may need to set Collision Profile Name and Collision Response to Channel between those two. At least thats how my weapons work when i want to drop them.

I’ve tried switching around the order which set master pose component, set simulate physics and detach from parent nodes are run, but it doesn’t seem to have any effect. I also did play around with the Collision channels, but the problem doesn’t seem to be related to those. All of the objects that are part of the dismemberment system use Ragdoll as their collision preset which works fine in itself.

I think the main culprit here is the set master pose component and how setting it to null somehow recalls the position where it was first set. Here’s a short video of what’s happening if I don’t use the 0.1 second delay node:

https://youtube.com/watch?v=IsDG6IJqb1A

So perhaps store the current world location just before you set it to null, then reposition the object straight away after?

I did try that, but it seemed like the detachable components transform was where I originally set the master pose component for it. So the result is same as when not using the delay node (as shown in the video). Why adding the short delay fixes this is beyond me. Maybe it’s a bug?

Have you managed to solve this ? I’m having a very similar problem.

Quite a while back but I would suggest you destroy the component and spawn a new 1 exactly where it was positioned instead of trying to use that attached component.

The way I achieved it was scaling the bone down to 0 in the animbp and spawning a mesh of the body part with physics enabled in it’s place.