Making first-person movement with acceleration isn’t too hard, but I’ve not found anything on this variant I’ve been thinking about:
How could it have acceleration, but as soon as I let go of one of the movement keys - that direction’s velocity instantly goes to 0.
Could you still use lerp() for that because if so I’ve got no clue how I can make it only lerp when accelerating.
It’s not actually for a serious project, I was just playing around with it and it didn’t work.
So you want to add acceleration? Then define a variable target_velocity and assigns its value instead of velocity, then after you set the target_velocity, do like this:
You can decrease the 10.0 for more acceleration or increase for less.
You can also set the value of velocity to target_velocity directly whenever you want, using the if direction statement.
As @gertkeno said, you can also use move_towards. As I generally not use it, so I forgot how to use it. But lerp is not bad, you can use it, both will work.