Question about move_toward and lerp

Godot Version

4.3 stable

Question

So I have a character controller for a characterbody2d. Sometimes his movements are too abrupt like when he stops moving. I suspect its because in some cases when I want him to stop moving I do something like move_toward 0 or lerp to 0 but like I said in some cases it looks abrupt.
Would it be better to add velocity with velocity += and then stop adding when not pressing button or is there something else that can be done for smoother movement?

move_toward is good and easier to manage than lerp. You could reduce the move_toward delta to stop slower, what does your code look like right now?

If you merely stop adding velocity then the character body will gain speed and never lose speed.

Well the main example in my project is when ny character jumps off a wall and I let go of the jump button it lerps to 0, its like variable jump height, but in that scenario its always too abrupt or too floaty for my taste, but I’ll try using move toward when I get back home later. Also I was wondering what you mean by saying move toward is easier to manage

lerp and move_toward take three parameters, a, b, and a delta. The first two are the same, two target points usually a from and a to.

The third parameter is wildly different, for move_toward the third parameter is measured in pixels (for 2D), it takes the a and directly adds or subtracts the delta so the resulting value is closer to or exactly b.

lerp’s third parameter is a percentage from a to b, if you supply 0.0 lerp will give you a, if 1.0, then b is returned, and any number in between will result in a value between the two, such as 0.5 would give you the mid point. This value changes every frame so lerp should not be used for consistent movement on per-frame effects.