I’m going through a book on Unity, and this chapter was about using a script to rotate a cube, and stop rotating when the cube is clicked on. I decided once done with the chapter to fork the script and make one that would rotate a cube, and when clicked on would slow down and then begin rotating in the opposite direction.
The issue is that when rotationSpeed hits 0, it stops entirely. I tried kickstarting it by waiting a frame and then setting it to the value I change it by, but it doesn’t accelerate after that. Script here, in JavaScript.