Swerve mechanic, Move left and right with touch

Hello, I am making a hyper casual game and I am stuck at the movement I want to implement the swerve mechanic but it is not working. I am using the deltaposition.x of the touch it works fine moves left and right but it is so laggy, stutters a lot.

Code:

private void Start()
{
    characterController = GetComponent<CharacterController>();
    gameManager = FindObjectOfType<GameManager>();
}
private void Update()
{
    dir.z = forwardSpeed;
    forwardSpeed += 0.01f * Time.deltaTime;
    forwardSpeed = Mathf.Clamp(forwardSpeed,4.5f,7.5f);

    if(Input.touchCount > 0)
    {
        Touch touch = Input.GetTouch(0);
        if(touch.phase == TouchPhase.Moved || touch.phase == TouchPhase.Stationary)
        {
            xAxis = touch.deltaPosition.x * sideSpeed * Time.deltaTime;
            dir.x = xAxis;
        }
        if(touch.phase == TouchPhase.Ended)
        {
            dir.x = 0;
        }
    }
    if(characterController.isGrounded == true && dir.y < 0)
    {
        dir.y = 0;
    }
    else
    {
        dir.y += gravity * Time.deltaTime;
    }
}
private void FixedUpdate()
{
    if(gameManager.gameOver == false && gameManager.gameStarted == true)
    {
        characterController.Move(dir * Time.deltaTime);
    }
}

}
`

When you assign dir.x and dir.y, you already multiply them by Time.deltaTime, which makes them scaled to work only in the Update() function, and of course not in FixedUpdate().

So just remove the FixedUpdate() function and add at the end of the Update() function:

if(gameManager.gameOver == false && gameManager.gameStarted == true)
{
    characterController.Move(dir);
}

You may need to adjust the speed after that, but it’s not difficult.

In addition, deltaPosition will only work correctly in Update().