At the moment i have been playing around with “moving stuff forward” with script.
I have imported a car model into my scene and attached the script to it, so now i can press “W” to go forward and “S” to go backward.
So the question is…
How do i make the car slowly speed up to the top speed after a certain amount of time, and slowly slow down when the “W” key is let go?
Use an acceleration value, which you will add to the speed over time, when the W button is pressed. Add the acceleration, until a maximum speed is reached.
When the W button is released you use the same or another acceleration value and subtract it from the speed, until zero is reached.
Over time means that every frame you apply the acceleration according to the frame time.