JamieHyland1 / 4thYearDemo

A small proof of concept demo for my fourth year project.
1 stars 0 forks source link

Moving the camera sometimes spasms out #3

Open JamieHyland1 opened 4 years ago

JamieHyland1 commented 4 years ago

If you press the button to move the camera left or right too many times the camera swings in the opposite direction, this is due to it iterating through an array for the camera angle to lerp to see:

float[] degrees = {225,135,45,315};
   if(Input.GetKeyDown(KeyCode.D)){
           if(rotateIndex < 3) rotateIndex++; else rotateIndex = 0;
           rotateTo = rotateIndex + 1;
           if(rotateTo == 4) rotateTo = 0;
           Debug.Log(rotateTo);

   }
JamieHyland1 commented 4 years ago

Ideally if you press the button before the camera stops moving it shouldn't do anything.