- Home /
Rigidbody+collider conflicts with ragdoll structure
Hello, the commUnity! :)
Currently I'm working on a character controller system, based on using Mecanim (animations move the character). So I've watched this tutorial and made practically the same. In particular, I've added a rigidbody component and a capsule collider to the character. Everything worked fine, until I've decided to use a ragdoll instead of a death animation: the character now slides slightly in the forward direction. In fact, it is standing on the horizontal plane, so the gravity force doesn't seem to be able to move the character.
Do you use your actual player to make the ragdoll because if that's the case i would suggest you use a seperate $$anonymous$$odel which you set up using only ragdoll and colliders. If the player dies you can just replace the player with the Ragdoll-Prefab. I didn't yet use macanim really so i don't know if any of that could interfer with the ragdoll.
Yeah, I'm using exactly the same character as the one, I'm controlling, and the one, carrying the ragdoll structure. Thanks a lot - your suggestion seems to be a good idea!
Btw, if anyone has information about the conflicting relations of ragdoll and collider - post a comment, please. I'm still interested in understanding the reason for this situation.
Answer by Wieljer · May 13, 2015 at 07:37 PM
I wanted to reply to this older post because it was the only post that seemed relevant to an issue I had been looking for an answer to. I hope this will help others trying to fix the issue.
In my instance of this problem, the ragdoll was colliding with the character controller Capsule Collider.
In the picture attached you can see the larger character controller capsule sphere and then the ragdoll capsules and boxes around each limb of the character. What was happening in my scene was the physics engine was battling the capsule collider causing many collisions. This resulted in my character moving in a direction and in my case many directions pretty quickly so I was basically flying around the map... It was very confusing. So I then tried to remove the animator and found that my character was no longer flying because he would just ragdoll without any animations playing. But i noticed that when I hit 'play' the character ragdoll would launch away from the larger capsule collider to get out of it. I then realized that you must use the edit>project settings>physics tap to set the layers so that they ignore collisions on each other. In my case i set the hips of the character (which contains all of the characters limbs) to the 'ragdoll' layer and then unchecked the 'player' layer which was where my sphere collider resides. Then bam no more flying or weird ragdoll getting launched away from my capsule collider.
Answer by F0rge1cE · Feb 17, 2017 at 09:14 AM
Three steps to solve this problem:
set your character to "player" layer, only the top object, do not include children. (you should create this layer yourself)
set the character's hips to "Ragdoll" layer. Also, create the layer by yourself. This time include all chidren of hips.
add this line to your script: (assume layers created above are layer8 and layer9)
Physics.IgnoreLayerCollision (9, 8, true);
Your answer
Follow this Question
Related Questions
force before ragdoll 1 Answer
Ragdoll with multiple colliders 0 Answers
how to have both RIGIDBODIES and COLLIDERS 1 Answer