Godot Version
4.7.1
Question
hey, i’m trying to follow some tutorials for creating a 2d platformer and i’m running into this issue where lerping doesn’t appear to be working? my goal here is to try to have the player accelerate from 0 speed to their target walking speed, but it appears to just multiply the “to” value by the “weight” value
my horizontal movement code:
// kb inputs
if (Input.IsActionPressed("move_left"))
{
movementDir -= 1;
}
if (Input.IsActionPressed("move_right"))
{
movementDir += 1;
}
if (movementDir != 0)
{
velocity.X = Mathf.Lerp(velocity.X, movementDir * horizontalSpeed, acceleration);
}
velocity is a local variable for Vector2, movementDir is an int, horizontalSpeed is a float, and acceleration is also a float
here’s how my log looks if i attempt to log my velocity:
![]()
would anyone know a better option than lerp or a way to fix this jank? thank you if you decide to help