- Home /
Stop ragdolls from colliding with each other?
So, I'm making a third person shooter, and I want the dead bodies to be ragdolls. Normal stuff. So now I've run into a problem where ragdolls collide with each other (which they should). I don't want that to happen. I know how to use a Physics.IgnoreLayerCollision()
, but setting that to ignore collisions on my "ragdolls" layer (layer 11) stops the ragdolls from colliding with themselves (one ragdoll's arm will fall through his torso). I only want ragdolls to not collide with other ragdolls. Their arms should not fall through their chests. This is seen in pretty much every shooter ever, and yet I can't figure it out. Can anybody help?
Answer by Craftnime · Aug 27, 2015 at 09:19 AM
Ah! On the top of the inspector panel (In default layout it is on your right) there should be two dropdowns, one called Tag and one called Layer. You click on the layer dropdown (in which it should be Default) and you go alll the way down in order to click on "Add Layer...". You should be brought to an editable list sort of thing in the inspector panel. On one of the empty "User Layer" slots, type in the name of your new layer, named "Ragdoll_body".
Assuming all your ragdolls are in the "Ragdoll" layer, move all the torsos (well, all the parts of the main body, not the arms, legs or head) to the layer "Ragdoll_body" (If you get a popup, just click "change all children as well"). Then on the top bar, you would want to go to Edit>Project Settings>Physics. You should see a checkbox triangle grid on the inspector panel. On the checkbox that lines up with "Ragdoll" and "Ragdoll", uncheck it so that the tick disappears. On the checkbox that lines up with "Ragdoll_body" and "Ragdoll_body", uncheck it so that the tick disappears as well. Now your collision problem should be fixed. Also no need for that ignore collision command.
Answer by TheonlysiQ · Jun 02, 2020 at 11:13 AM
On the hopes that you guys are still active here, I will be posting my feedback about this issue.
The solution @Craftnime proposed seems to work, albeit having an unintended effect: While the ragdoll wont collide with other ragdolls, it wont collide with itself anymore either, which is not desired (at least not by me). So do you have any ideas what i could do in order to achieve only the desired result?
Reference ticket created specifically for this question: https://answers.unity.com/questions/1736445/i-want-ragdolls-to-not-collide-with-eachother-but.html