this is triggered animation script enjoy

dont forget subscribe here [You must be registered and logged in to see this link.]


var chestSound : AudioClip; //chest opening sound clip goes here
var treasureChest : GameObject; //treasure chest prefab goes here

function OnTriggerEnter (col : Collider) {

if(col.gameObject.tag == "Player") { //checks to see that our character controller with tag "Player" has entered the trigger
AudioSource.PlayClipAtPoint(chestSound, transform.position); //plays our soundclip at position of collider/trigger
treasureChest.animation.Play(); //plays the default animation applied to our treasureChest model
Destroy(gameObject);// destroys the gameobject that has this script, so our collider in this case

}
}