how can I animate my player when it passes a trigger?
function OnTriggerEnter(hit : Collider)
{
if(hit.gameObject.name == "Player") // this bit probably needs changing to suit your game
{
hit.gameObject.animation.Play(); //change this to Play("animation name") if you like
}
}
this WORK! find on unity forum:
var animateobject: GameObject;
function OnTriggerEnter (collision : Collider)
{
if (collision.gameObject.tag == "Player") //
{
animateobject.animation.CrossFade ("animationname");
}
}