I am trying to use a button model to activate different objects (platforms, lights, doors, etc…)in my scene. Once i step on the trigger object (button) my animation plays just fine. I want to play an animation to go back to the “idle” state once I step off of the button so I can deactivate the other objects, however I am uncertain how to write the OnTriggerExit function.
I can say from experience on here some folks are rude and make you feel stupid for asking such “elementary” questions so If you are going to be rude and make me feel stupid for asking then please just pass this post by. BUT for anyone who doesn’t mind explaining something to those of us who are wanting to learn, PLEASE help me out on this one.
#pragma strict
var buttonSound : AudioClip;
var pushButton : GameObject;
function OnTriggerEnter ( col : Collider)
{
if (col.gameObject.tag == "Player")
{
AudioSource.PlayClipAtPoint (buttonSound, transform.position);
pushButton.GetComponent.<Animation>().Play();
}
}
function OnTriggerExit ( col : Collider)
{
}