Ignore Collisions Between RagDoll Components of Same Parent

Hi there,

Again thanks in advance to this community for being so helpful.

So I have been searching for over 6 hours and have yet to find the correct implementation for what I need!!

Basically, I have a ragdoll set up, with colliders and rigibodies, etc.

However, the pieces of the ragdoll are colliding with on another (i.e. arm is colliding with upper arm).

I have a bool set to trigger on collision of the ragdoll components, but I don’t want collision between internal ragdoll components to trigger this bool.

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class ZombieScript : MonoBehaviour {

	public int scoreValue;
	private Animation zomAnim;
	public bool isDead = false;
	GameObject[] bodyParts;

	void Awake()

	// Use this for initialization
	void Start () 
		zomAnim = transform.root.gameObject.GetComponent<Animation> ();
		bodyParts = GameObject.FindGameObjectsWithTag ("bodyParts");

	// Update is called once per frame
	void Update () 
		Physics.IgnoreCollision (bodyParts.collider, collider);

	public void ragDollIt()
		isDead = true;
		if (isDead == true) 
			zomAnim.enabled = false;
	void OnCollisionEnter()
		if (this.gameObject.collider.tag != "bodyParts") 
			ragDollIt ();
			Debug.Log ("YourCodeSucks");

I tried setting the OnCollisionEnter to have an if the collision has the tag, don’t count it, but I don’t think I did it right.

Any help is appreciated!!



You should be able to remove layers from ragdoll components to collide with each other.

More info: Unity - Manual: Layer-based collision detection