Trigger when 3 triggers collide.

Hi All,

I’m trying to do something really simple, trying to get something to happen when 3 or more triggers collide.

Let’s say I have a main trigger A, and then 2 other triggers B and C.
If B collides with A alone, nothing happens.
If C collides with A alone, nothing happens.
If B & C both collide with A (at the same time or one after the other, as long as they are colliding together at some point), I would like this to make something happen.

So I tag both of the colliders and try this script (which I put on A) but it doesn’t work…

  void OnTriggerEnter(Collider other) {
{
if (( other.gameObject.tag = "B") && ( other.gameObject.tag = "C"))
}
        Do This();
    }

Is this because "Collider other"is only reference to one object, and not two ?

Thanks !

Hyper

Try this instead. (I fixed your curly braces and boolean checks).

    bool collidingB = false;
    bool collidingC = false;

    void OnTriggerEnter(Collider other) {
         if ( other.gameObject.tag == "B" ) collidingB = true;
         else if( other.gameObject.tag == "C" ) collidingC = true;

         if( collidingB && collidingC ) {
              Do This();
         }
    }

    void OnTriggerExit(Collider other) {
         if(other.gameObject.tag == "B") collidingB = false;
         else if(other.gameObject.tag == "C") collidingC = false; 		
    }