How to detect collision between 3 objects

Jan 22, 2012 at 9:33 AM

Hello.... I have made a game wherein i have to catch a collision event when two objects("ellipse1" and "ellipse2") touch the the ground at the same time. I'm doing the project for windows phone7 using farseer physics. The ground and the two objects are  physics objects. 

I'm only able to detect collision between the ground and anyone of the object not all three of them simultaneously. could anyone help me out with this. 

This is the code....

  phy.Collision += new PhysicsControllerMain.CollisionHandler(phy_Collision);

 

 void phy_Collision(PhysicsSprite sprite1, PhysicsSprite sprite2)    

 {       // i can only check collision b\w ellipse1 and ground but not b/w ellipse1 and ellipse2 both simultaneously.

    if (sprite1.Name.Contains("ellipse1") && sprite2.Name.Contains("ground") )        

   {  

      phy.PhysicsObjects["ellipse1"].BodyObject.Restitution = 0F;

       }       

   }