Rag Doll Attached To Parent Capsule Component (So TRICKY)

I’ve done so much research on this issue and its led to so many dead ends or false hopes.

Essentially I have a mesh that is attached to a Capsule Component (context this is for a MP game) and this Capsule Component’s Character Pawn is replicated on the network ok great (just as a heads up networking isn’t the issue here).

The issue at hand is, if I set simulate physics be it from SetAllBodiesBelowSimulatePhysics(MyRootBone) or just all of them the mesh when it gets its collision set to rag doll just Detaches from the Capsule. This is intended behavior it seems and I have not found away around this.

I accepted such a fate and opted to just re-attach the using AttachTo or AttachToComponent but unless I set weldSimulatedBodies to true the attach fails and if I do set it to true then it loses its rag doll.

So to sum up is there a way to get a rag doll to stay attached to its parent as a rag doll?

EDIT: I didn’t want to resort to this but I’m attempting to see how bad setting its location on tick is going to be and what I may be able to work with doing it this way.

Nope, there’s - as far as i know - no way.
The reason why:
Just think about how the physic would look like if it’s still attached to the root. How is it supposed to move? It can’t.
(My thoughts, it doesnt have to be correct.)

I’m doing it the same way.
Simulate the physics on the server, compare it with the local physic transform on the client.
If the difference is too big between the server and client, correct the object on the client.
This means there’s always a very small difference between server and client, but there’s no way to change this because of the performance / network usage.

Correct the root if the physic state is getting changed / disabled.

Network physics are tricky!

Just to be clear here I don’t need all bones to be replicated accurately. I don’t need an exact 1 to 1 positional track of all bones to everyone.

I just need the Rag Dolls general location to be replicated. If that is via one bone then great. After that the rest of the bones can be wherever since I know that they are all attached when one bone moves the rest should move even if they are not accurately in the “right” spot as the server.

You’re going to need to do something a little custom to get that behavior - what you’ll need to do is have an event trigger when the ragdoll’s velocity is low enough that you consider it to be “stopped”, then rep the position of the root (check it with a timer, for instance). The real problem arises in that if you want the players to see the ragdoll at that location you’ll also need to move their local ragdolls there.

Another approach is to replicate certain points on the ragdoll, but not all - e.g., just enough to give you rotation automatically. For a human character this is probably 2 points - waist and head. Then you’ll need to basically “push” the client ragdolls towards these points constantly (with the actual add force etc functions).

It works okay unless stuff gets in the way on the client side in which case it will diverge and basically get dragged around, but for human characters it’s not that huge an issue, but for e.g., quadrupeds it’s nearly impossible to get them to not get stuck on things like trees.

What I’m not so sure about is how to get just root gone data.

I can’t seem to figure out how to set root bone or get root bones location.
Also by Rep I assume you mean manually set location right? If not what exactly do you mean?

EDIT:

So I’ve tried forcing the position on the server when some one grabs it and that doesn’t seem to be working for anyone but local.

FYI I get the Skeletal mesh when I grab and then SetWorldLocation to the Actor who grabbed it.
Any reason why this wouldn’t work?

2 ways I can think of off the top of my head:

  1. Use a physics constraint (e.g. constraint component). This is how you’re “supposed” to do it in the physics engine
  2. Teleport one of the ragdoll bodies to match some attachment transform on the capsule after physics ticks for the frame. Key here is to make the target ragdoll body kinematic (SimulatePhysics = false) which will make the teleports behave as if the physics engine moved them there, i.e. integrates motion properly. Won’t look as good if the target ragdoll body is simulated. Not sure if you can do this method in blueprint