Question by
arkea · Dec 28, 2015 at 12:31 PM ·
vranimationsconditionconditional
Problem condition in Animation
Hi guys, I need your help for a little problem in Animations.
Actually, I want to make Door which goes up and down. I've already done normal doors and sliding doors. With the same scripts i wanted to make my animation but arrived to the condition "Close" it always pass it.... which is impossible because my "Player" is still in the Collider >< Ican't understant and i really need your help ^^.
Theres is my code :
Animator anim;
bool doorOpen;
void Start () {
doorOpen = false;
anim = GetComponent<Animator> ();
}
void OnTriggerEnter(Collider col) {
if (col.gameObject.tag == "Player") {
doorOpen = true;
Doors ("Open");
}
}
void OnTriggerExit(Collider col){
if (doorOpen) {
doorOpen = false;
Doors ("Close");
}
}
void Doors(string direction) {
anim.SetTrigger (direction);
}
Note that my others doors work perfectly !
Comment
Your answer
Follow this Question
Related Questions
OnPointerEnter 0 Answers
How To Check If GameObject Next To Another GameObject 1 Answer
Cardboard camera issues 1 Answer
Gear VR Loading screen freeze 0 Answers
Mapping Input with GearVR 0 Answers