- Home /
 
               Question by 
               Kunaljani4536 · May 03, 2014 at 12:19 PM · 
                animationcollidertrigger  
              
 
              Is this script rightfor trigering animation?
Hi guys i have two objects. A balloon and a thorn.I want to make balloon burst when it touches thorn.I have made animation of balloon getting burst name "balpop".I have attached rigid body and box collider to both thorn and balloon.Trigger is checked on thorn.And i have attached following script to balloon.
 `#pragma strict
 
 var balloonburst : AnimationClip;
      
   function OnTriggerEnter (thorn : Collider) 
     {
         if(thorn.tag == "thorn")
      {
        animation.Play("balpop");}
}
`
But its not working i do not know what am i doing wrong? please help me i have searched a lot but its not working.i am using java script.Thank you.
               Comment
              
 
               
              Answer by Swaggre · May 03, 2014 at 12:33 PM
try
 function OnTriggerEnter (thorn : Collider) {
 
 if(thorn.gameObject.tag == "thorn"){
 animation.Play("balpop");
 }
 
 }
And make sure that either one of the gameobjects colliding has a rigidbody and that isTrigger is ticked in collider settings
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                