Ignore collision?

How can I ignore collision between two rigidbody objects? I know physics.IgnoreCollision function, but it only works if the objects are different than each other. in my case they’re same. Basically I don’t want my enemy characters collide each other.
Thank you

It is, by definition, impossible for two separate objects to be the same. Physics.IgnoreCollision will work fine.

Physics.IgnoreCollision(enemy1.collider, enemy2.collider);

–Eric

Thanks for the answer Eric, but the problem is my rigidbody objects are also ragdoll objects which means that they have colliders for each of their body parts. Physics.IgnoreCollision(enemy1.collider, enemy2.collider); works only with one collider. I tried to use it inside a recursive function to check each of its colliders, but that didn’t also work.

Let me post the code;

function ignoreCollision(root : Transform,hitObject : Collision)
{
	for (var child : Transform in root)
	{
		if(child.rigidbody)
		{
			if(hitObject.gameObject.tag == "Enemy")
			{
				Physics.IgnoreCollision(hitObject.collider,child.collider);
			}
		}
		if (child.childCount > 0)
		{
			ignoreCollision(child,hitObject);
		}
	}
}

function OnCollisionEnter(hitObject : Collision) 
{
	ignoreCollision(transform,hitObject);
}