ignore triggers

looking for a simple way to say i want this trigger to ignore certain objects. so say i have a human with colliders on him which are triggers and one of them activates something when it hits or gets hit. the only problem though is if one of these triggers touch each other it activates the other thing…

i was going to say if this trigger hits the certain thing then it activates but there are a lot of different things in my game that activates this

so basically need a bit of code which simply says ignore this object/trigger…

i know how to ignore collisions but this is no good as it adds unwanted movement to the character and extra weight.

got it its

`Physics.IgnoreCollision(collider, transform.gameObject.Find("").collider);`

if anyones got anything better let me know

To achieve that you have to use a good combination of layers. And set their relation regarding Physx properly. See http://unity3d.com/support/documentation/Components/Layer%20Based%20Collision%20detection.html

Note that you can change the layer of any object (and child object) at runtime so they might fall into one or another category (colliding, not-colliding…).

You can place objects in different layers and define the Collision Matrix, so objects in one layer can collide only with objects in other specific layers, but more frequently you just use special tags to identify the objects that can be activated, collected etc.:

function OnTriggerEnter(other: Collider){
  if (other.CompareTag("Switch")){ // use CompareTag...
    // call Activate(true) in the other object's script
    other.SendMessageUpwards("Activate", true); 
  }
  if (other.tag == "Bonus50"){ // or compare the string directly
    Inventory.bonus += 50; // count points in a static variable...
    audio.PlayOneShot(bonusSound); // play the appropriate sound...
    Destroy(other.gameObject); // destroy the picked object
  }
}

function OnTriggerEnter(other: Collider){
  if (other.CompareTag("Switch")){
    // call Activate(false) in the other object's script
    other.SendMessageUpwards("Activate", false); 
  }
}

This way you can take the appropriate actions for each kind of object.