Proper/optimized way to ragdoll an animated character

Hi everyone,

I’m developing a VR FPS game on Windows that will need the use of ragdolls for death.

For now, I used the built-in wizzard to create ragdolls for my animated characters. When the character dies, I disable the animator, switch the rigidbodies from kinematic to non-kinematic, and enable their collision detection. The problem is that there is no way to disable completely the rigidbodies.

Unity documentation advices to proceed the way I did. The problem is that when the character is not ragdolized, rigidbodies create massive overhead on Physics and scripts when they are moved by the scripts and by the animator.

Is there a better way to “disable” Rigidbodies?

I’ve tried pooling a second character as ragdoll and replacing on death, the issue is that it seem to glitch with physics and the ragdoll has weird behaviour, probably due to the fact that I update all transforms at once on death to make it match the previous character’s animation.

Do you have other solutions?

Thank you for your help!

Good question… I’d be curious if setting rigidbody.detectCollisions = false when the rigidbodies are “disabled” would help reduce or eliminate the overhead?

Also make sure all colliders and physics constraints are disabled (if it’s possible to disable them. Cant remember)

Hi Philsa, thank you for your answer!
No, rigidbody.detectCollisions = false (or changing layers to non-colliding one) doesn’t seem to change anything for kinematic objects in terms of performances, collision tests still seem to be performed, functions resulting from these tests just don’t seem to be called.