player moves faster diagonally and normalizing doesnt seem to work

I made that the player speed changes depening on how far i push the analog, so that it can go from walk to run etc…, one issue i have is that if i move diagonally while using the keyboard the player moves slightly faster.

This is my movement script:

private void HandleMovement()
        move = new Vector3(currentInputVector.x, 0, currentInputVector.y).normalized;
        if (move.magnitude >= 0.1f)
            //Calculate rotation
            float targetAngle = Mathf.Atan2(move.x, move.z) * Mathf.Rad2Deg + cam.transform.eulerAngles.y;
            currentAngle = Mathf.SmoothDampAngle(currentAngle, targetAngle, ref currentAngleVelocity, rotationSmoothTime);
            transform.rotation = Quaternion.Euler(0, currentAngle, 0);

            //move in direction of rotation
            Vector3 rotatedMovement = Quaternion.Euler(0, targetAngle, 0) * Vector3.forward;

            //Calculate player speed based on analog input, and changes the player'speed based on the slope
            if(getSlopeInfo >= 30){
                speedCalculation = (Mathf.Abs(currentInputVector.x) + Mathf.Abs(currentInputVector.y)) * speed/((getSlopeInfo/10)/2.5f);
                speedCalculation = (Mathf.Abs(currentInputVector.x) + Mathf.Abs(currentInputVector.y)) * speed; 

            // set the movement speed
             movementSpeed = rotatedMovement * speedCalculation * Time.deltaTime;
            // move the player using the CharacterController
            if (!onLedge)


As i said i tried to normalize but it doesnt work, and i cant figure out what could be the problem, i suspect something in the speed calculation.

Use speedCalculation = move.magnitude * speed; instead of speedCalculation = (Mathf.Abs(currentInputVector.x) + Mathf.Abs(currentInputVector.y)) * speed;

Your problem here is that you normalized the direction but calculated the speed magnitude in such a way that you’ll get a velocity of 2 if you have a diagonal input (1,1)

Also you can simply replace Vector3 rotatedMovement = Quaternion.Euler(0, targetAngle, 0) * Vector3.forward; by Vector3 rotatedMovement = transform.forward;

Or just replace movementSpeed = rotatedMovement * speedCalculation * Time.deltaTime; by movementSpeed = move * speed * Time.deltaTime; (although you’d need to readjust the speed to take the slope into account)