Question by 
               kryptonianwizard · Apr 22, 2016 at 10:13 AM · 
                animationcollisioncollider  
              
 
              I want to trigger an animation upon collision with a 2D obstacle in my infinite runner game.Help me.
void OnCollisionEnter2D (Collision2D col) { if(col.gameObject.tag == "floor") jump = 1; { if(col.gameObject.tag == "obstacle") this.GetComponent().Play("hero_death");
     }
         if(col.gameObject.tag == "obstacle")
     {
         if(col.gameObject.name == "bp")
             GetComponent<Animation>().Play ("bp_d");
     }
     else 
     {
             if(col.gameObject.name == "dust")
                 GetComponent<Animation>().Play ("dust_d");
         }
     else
     {
         if(col.gameObject.name == "sc")
             GetComponent<Animation>().Play ("sc_d");
     }
     
 }
}
 void OnCollisionExit2D (Collision2D coll)
 {
     if(coll.gameObject.tag == "floor")
         
         jump = 0;
}
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                