Moving part of a skeletal mesh, while staying anchored to rest of the mesh that stays in place

Hello there,

I’m trying to move the upper part of a human mesh, while the legs and pelvis should stay in their original location (and the body shouldn’t separate of course). Where I’ve gotten right now is moving the torso and arms in a ragdoll way, and keeping the legs stiff, but they still move along with the rest of the body. I use the node ’ set all bodies below use physics’ in BP. This screenshot can maybe give some clarity:

What I’m looking for, is a way to stick the legs to the bed, so they can’t move, and they are the anchor point for the rest of the body. So the torso should be able to bend and rotate, with the pelvis staying in place. I’m using BP right now, but if this can only be achieved by using C++, that is no problem for me. I’ve tried some thing to restrics the movement of the bones in the legs, but so for nothing seems to work. You can see some tries in the screenshot below.

So basically, what I’m asking is: is this possible to do? Or should I split the mesh into 2 parts and can I anchor the top part to the bottom part in any way?