static var finished = false;
static var started = false;
function Start () {
started = true;
LevelUp.minSpeed = 0.0;
LevelUp.maxSpeed = 0.0;
}
function Update () {
if (transform.position.z > 4) {
StopSpinning();
}
}
function StopSpinning () {
Destroy (constantForce);
Destroy (rigidbody);
transform.rotation.x = 270;
transform.rotation.y = 0;
yield WaitForSeconds (1.4);
LevelUp.minSpeed = LevelUp.newmin;
LevelUp.maxSpeed = LevelUp.newmax;
finished = true;
started = false;
Destroy(gameObject);
}
In the function StopSpinning, you can clearly see that I set the X to 270 and the Y to 0 (the Z is always 0), but instead of appearing correctly it is set to (0, 180, 180), which makes this particular GO completely invisible. If I pause and change it to the correct rotation it immediately snaps back when I unpause. What is going on here?