Hi…
I have a door with an animation. This animation starts automatically with the OnTriggerEnter.
There’s a car with an animation (I have done 4 prefab of this, So there are 4 same car) when the first car starts the door should open, instead It dosn’t, when the second car starts, the door opens! When i make start the third car, the door doesn’t open again, and with the fourth car the door works again…
ps: the door’s box collider is on “trigger”.
This is really strange! someone can tell me why? Thank you in advance!
Here’s the script of the door:
#pragma strict
var Animazione = "PortaAutomatica";
var on : boolean;
var Audio1 : AudioClip;
function OnTriggerEnter (other : Collider) {
on = !on;
if (!on){
GetComponent.<Animation>()[Animazione].speed = 0.2;
GetComponent.<Animation>().Play(Animazione);
GetComponent.<AudioSource>().clip = Audio1;
GetComponent.<AudioSource>().Play();
}
if (on) {
}
}