- Home /
 
Animating a button press from maya file problems
I'm new to processing and I've been trying to animate a button being pressed when the 1st person character enters a trigger box and presses the "f" key. I set up 2 scripts, one for the box:
      var bigbutt2 : Transform; // This is a reference to the door GameObject that has your animation
 private var HasTriggerBeenUsed : boolean = false; // This is to make sure that the button is not repeatedly pressed.
 private var setTrigger : boolean = false;
 function OnTriggerStay() {
 if (Input.GetKeyDown("f") && !HasTriggerBeenUsed) {
 bigbutt2.animation.Play("buttonprssanim");
 setTrigger = true;
 }
 else if (Input.GetKeyDown("f") && HasTriggerBeenUsed) {
 bigbutt2.Play("buttonpressanim"); // Insert name of DoorClose animation instead of that
 setTrigger = true;
 }
 if (setTrigger) { HasTriggerBeenUsed = !HasTriggerBeenUsed; }
 }
 
               and another for the button:
var animateobject: GameObject;
function Update () { if(Input.GetKeyDown('')){ animateobject.animation.Play ("buttonpressanim");
buttonpush.Update (); //function OnGUI(){ //(GUI.Button(Rect(205, 250, 180, 40) } }
I want the character to be able to press the button and a menu to pop up
can anyone tell me where im going wrong?
Your answer
 
             Follow this Question
Related Questions
LoadLevel to menu error 0 Answers
Bizarre non-responsive button/Mecanim issues 1 Answer
Sliding sub-menu from behind an icon 0 Answers
GUI Menu Display Help 2 Answers
OnCollisionEnter not getting calle! 1 Answer