What is the proper way to setup ragdolls?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By wowzzers

I disable physical skeleton (ragdoll) so the player won’t collide with it in the scene. When my enemy dies I re-enable it. But it loses gravity and starts to float around. What is the problem?

Here’s the code:

if !is_dead:
	for b in $mesh/bones/skeleton.get_children():
		if b is PhysicalBone:
			for c in b.get_children():
				if c is CollisionShape:
					c.disabled = true
else:
	for b in $mesh/bones/skeleton.get_children():
		if b is PhysicalBone:
			for c in b.get_children():
				if c is CollisionShape:
					c.disabled = false

if is_dead:
	for c in get_children():
		if c is CollisionShape:
			c.disabled = true

And here is the video.

I tried re-setting parameters like this (doesn’t help):

b.mass = 1
b.weight = 9.8
b.gravity_scale = 1