Make OnCollisionStay to NOT activate when chosen child collider collides

I have this car object with a rigidbody and an OnCollisionStay script attached. The OCS (OnCollisionStay) worked but my car had wheel colliders and the OCS gets activated. What I want is the OCS to ignore my wheel colliders. Is it possible?

There’s three main ways to do this:

1: Add the wheels to an own wheel collision layer, and set that to not collide with the car.

2: Add a tag to the wheels, and check that in OnCollisionEnter. If the collision is with something with that tag, don’t fire the particles. If the wheels already have a script on them, you can check for that instead.

3: This is the quick and dirty one that usually leads to issues, but might be what you want: Physics.IgnoreCollision. You give it two colliders, and those won’t collide. Check the caveats listed on the API before you use it, though.

Ok! Thanks for your help Baste! I finally found out!

I have to use thisCollider or otherCollider.

Here’s my final script for anyone wondering: (Note that it’s attached to the car object)

#pragma strict
var sparkles : GameObject;
var gforce : float;
var sparklesPrefab : GameObject;

function OnCollisionStay ( other : Collision )

gforce = transform.GetComponent(gForce).gforce;

for (var contact : ContactPoint in other.contacts)
	if ( contact.thisCollider.tag != "wheel colliders" && gforce > 0.01 )
			sparklesPrefab = Instantiate( sparkles, contact.point, other.transform.rotation);
			sparklesPrefab.transform.parent = transform;
			Destroy( sparklesPrefab , 0.5 );