Controlling the speed of player
Hello friends, I am new in unity. I am making a beginner type new game in which a bike (Currently using cube instead) is running on ground. Actually, the ground is going back which gives feeling that cube is going ahead. The camera is in a top-down view. Now, what I want is that when I press down arrow key, the speed of ground accelerate continuously to a specific limit say 20 and when i don't press any key, the speed should de-accelerate (decrease) to a specific limit say 5 and should stay at 5. I am currently using Vector.lerp in update function to move the ground but the problem is that i am not able to give a specific limit for speed while I am using vector3.lerp and second problem is that speed accelerate only once when enters play-mode and after that, it keeps on increasing. Is there any solution for all this? I am sorry for my bad English. Thanks in advance.
Your answer
![](https://koobas.hobune.stream/wayback/20220612123830im_/https://answers.unity.com/themes/thub/images/avi.jpg)