CharacterBody3D smooth movement problems

Hello! I try to make my Character body 3D move smoothly. I use the lerpf function to smooth the velocity values for this. However, whenever I try to turn, the smoothness breaks and the character becomes moveless. Trying to move the character again literally stops the movement completely. Here is my code

    inputDir = Input.get_vector("LeftMove_Key", "RightMove_Key", "UpMove_Key", "DownMove_Key")
	var relativeDir = Vector3(inputDir.x, 0.0, inputDir.y).rotated(Vector3.UP, cameraBase.rotation.y)

	# Smooth the movement
	var getAcceleration = delta * currentAcceleration
	velocity.x = lerpf(velocity.x, relativeDir.x, getAcceleration)
	velocity.z = lerpf(velocity.z, relativeDir.z, getAcceleration)

	# Apply movement
	groundMovement.x = velocity.x * currentMoveSpeed
	groundMovement.z = velocity.z * currentMoveSpeed