- Home /
play animation on collision+input?
i created an animated gate that plays the "move" animation when it gets activated.
in order to do that the player must walk up to the door to enter coalition and press F (which is in input settings called "opendoor")while colliding with the door.
so i had this script to control the coalition and the input.
sadly, even the debug.log wont show
function OnCollisionEnter(theObject:Collision){
if(beenHit == false && theObject.gameObject.tag=="Player"){
if(Input.GetButtonUp("opendoor")){
activate++;
Debug.Log ("door is opening");
}
}
}
function Update () {
if(activate>=1){
animation.Play("move");
beenHit = true;
Destroy(gameObject,3.5);
}
Comment
Your answer
Follow this Question
Related Questions
Player to Door Collision and Animation 3 Answers
Presure plate that triggers an animation 1 Answer
Creation of a door with collision for a FirstPerson game 0 Answers
open and close door 0 Answers