During this lesson, you may have been using the New Input System for practice and noticed that your ship rotates by the frame, and not smoothly like Rick’s.
This is simply because, on Keyboards, the old input system has built-in smoothing to its axes. Based on settings, input would work its way from 0 to 1.
In the new input system, base Keyboard inputs can either be 0 or 1. There is no in-between.
So, here is the video that I watched to fix this problem, but I’ll try and show how I implemented it into this project.
First, you need a Serialized float called smoothInputSpeed. I set it to be .1 at base. You’ll also want two Vector2s. One called currentInputVector and one called smoothInputVelocity.
Next, you’ll probably want to make a local Vector2 somewhere that’s hit with your update function. I put it in its own method called SmoothController. I called the local Vector2throw_, and it’s equal to the Vector2 from our movement input action. Then, we want to set our currentInputVector to equal a Vector2.SmoothDamp, with the current position being our currentInputVector, the destination being our throw_ variable, with a reference to our smoothInputVelocity and finished off with our smoothInputSpeed.
After that, set your xThrow and yThrow to the x and y of the currentInputVector respectively.
After that, if you’ve been following thus far, it should be smooth sailing. The rest of my programming is pretty identical to Rick’s, adjusted for the new input system. Adjust your smoothInputSpeed in the inspector and you are good to go.