I have a ragdoll which performs dying quite well when it is initialized. But when the same prefab object is re-used by being pooled and recycled, it jerks violently when die. As if some forces were left on the rigidbodies when the mesh is disabled.
My code goes through the rigidbodies in the ragdoll and sets isKinematic when the enemy is alive and does his usual animations, but turns isKinematic false when the enemy dies so that ragdoll can take over. From there the pool's lifetime kicks in giving the corpse sometime to be a ragdoll, then the whole gameobject is disabled and pooled. When a new enemy is to generated the pool is asked for one and it is provided. The enemy enters the game normally and performs it's animations correctly. This is where the problem occurs, when the enemy is killed a second time it "jerks" upward as if collapsing in on itself.
The only thing I could think of it that there are some forces left on the mesh when disabled and they activate again when the ragdoll is enabled through death. So I went through all rigidbodies and do:
rigidbody.angularVelocity = Vector3.zero;
rigidbody.velocity = Vector3.zero;
But this doesn't also work, so I'm not sure if it's remnant forces or even if there's such a thing.
What else could be effecting the gameobject to cause a sudden jerk in the ragdoll, which supposedly doesn't have any forces applied on it's inception?