Find ragdoll owner of bone collision, and ragdoll dismemberment


I have extended KinematicRagdollControl and implemented this method:

[patch] public boolean hasBone(PhysicsRigidBody prb){

if(prb.getUserObject() instanceof PhysicsBoneLink){

PhysicsBoneLink pbl = (PhysicsBoneLink)prb.getUserObject();


return true;


return false;



to discover which ragdoll is owner of the collision bone.

I couldnt find another way to “revive” (set character enabled) a specific ragdoll.

Also, I miss a way to dismember a ragdoll, to break the bone links.

If we had access to the PhysicsBoneLink fields, we could play with this too!


I don’t recommend using the ragdoll yet, because it’s a work in progress, and might change a lot.

Also you can add a RagdollCollisionListener to the KinematicRagdollControl that has a collide method.

This method send you the Bone that has been hit, the physics object that hit the bone, and the complete collision event.

You don’t need this hasBone method.

You can’t dismember the ragdoll…because it’s mean!! :x

No, you can’t because, it would imply cutting the associated mesh too, and I didn’t think about how to do this yet.

This is very unlikely PhysicBoneLink will be accessible , it’s really an inner data structure that should not be modified from the outside of the ragdoll.

Also, Bones, joints and rigid bodies are accessible by other means.

I cant avoid using ragdolls, its too much fun, and the physics looks great :slight_smile: (there is still some glitches if the force is too much, it begins bouncing and shaking uncontrollably, may even fly away, in this case the dismemberment could be a “workaround”, or could have force limits to prevent that? I am not completely sure about this tip anyway…).


I saw the RagdollCollisionListener, it worked! but it is limited to the weight threshold, if there is not enough force, the other object wont “collide()”, even if I dont want a physical result on the ragdoll (ex. I want it to revive, so the projectile dont need to have too much mass or force, but if it dont, the collide() wont happen…).

I wonder if I can set the threshold very low, and control if the ragdoll will be activated or not, within collide() (I may want other effects than revive that would disable the ragdoll and enable character). Still trying to understand how it works. I think I have to event.getAppliedImpulse(), then prevent that impulse from being applied to the ragdoll somehow? if I am going on the right path for this…

The hasBone() was called at BombControl collision() that I edited. So it wasnt limited by the weight threshold. I prefer detect the ragdoll from itself tho, it seems I can do more things from it, so I will stick to its collide() I think.

EDIT: btw, I have two identical ragdolls, but if one of it is hit be the projectile, both ragdolls receive the collide() event; not sure what to do to make them unique, still studding…


It wouldnt be mean if the ragdoll was a skelleton warrior, or a robot, or any bloodless monster like a gollem :D. Adding to that, there was a game that if we didnt pickup the skelleton bone, it would revive after some time, it could work for gollems also! I want to recreate that challenge/feeling :D.


If you want to cut a mesh, I found boolean operations and created a interface to JME, but… I dont know how usable that can be… as it is still slow… and it still have some glitches like messing with textures after object is cut, I dont know how to fix it… May be, even if you dont use it, it can give you some ideas on how to work on dismemberment :), here is the link:

I’m also toying with the ragdoll, and had 2 identical ragdolls receiving the same collision event (because they are both listening), i got around this like this …

pre type="java"
public void collide(Bone bone, PhysicsCollisionObject object, PhysicsCollisionEvent event) {

        if(animControl.getSkeleton().getBoneIndex(bone) == -1) return;

may help, good luck.

1 Like

Hey guys, well…I guess ragdolls are so attractive that people can’t help but use them!

@teique you can set the eventDispatchImpulseThreshold to 0 to receive all events, but be aware that you gonna have a lot of event coming from the collision of the feet and the ground.

For the mesh slicing, I’m gonna look into it it can be interesting.

@both about the 2 ragdolls receiving the event from each other, it’s sounds like a bug, thanks for reporting it, I’m gonna fix it.

Well…looks like I can’t prevent you guys to use the ragdoll, so any feed back will be appreciated :wink:

I accidentally cut my model in half by using a rig where the back(spine) wasn’t attached to the Root bone :stuck_out_tongue:

Yeah but the model was stretched, right? wasn’t sliced, was it?

Its still easily possible to dismember the ragdoll, just dont connect the meshes and care that the animations dont show the seams too much, then when some arm should fall off, just remove that joint from the physics space… only problem is the ragdoll doesnt know that and might crash when adding the joint twice or removing it when its already removed. In native bullet we’ll have a breaking force limit for the joints too :smiley:


works perfect! thx! will work til the fix :smiley:


I overridden the KinematicRagdollControl.collision(PhysicsCollisionEvent event); at it I check event.getObjectA().getUserObject(), if it has the BombControl, and so I backup, then I setEventDispatchImpulseThreshold(0), and after super.collision(event), I restore it.

Works great! now it always collide!

I think I will create a configurable threshold per object (or class type) that hits the ragdoll! Think like deflecting projectiles, will be automatic!



Just to test, I did this:


PhysicsRigidBody prb = (PhysicsRigidBody)objOther;

for(Object obj : prb.getJoints().toArray()){

if(obj instanceof PhysicsJoint){






It breaks the ragdoll!

But as nehon said, it is stretched and not disconnected; well, the head is disconnected! all other bones get stretched, may be it is not connected in the mesh already? So I guess models have to be prepared/edited for dismemberment (those xml files).

When I disable the ragdoll and re-enable the character, the animations work still perfectly.