Decrease sensitivity of mouse movement for Combination lock - c#

I’ve just started working on a simple combination lock, and i’m trying to make the mouse movement less sensitive. The idea behind this is that when the player left clicks the lock, it freezes player movement and allows the player to control the combination lock by moving the mouse left or right. The code that I’ve come up with works, but I’d like to make it less sensitive so it’s not so difficult to hit specific numbers. I’ve tried several ideas, but nothing seems to work quite like I want it to.

    public FirstPersonAIO fpAIO;
    public int currentCombNumber;
    public float mousePos;

    private void OnMouseDrag()
    {
        fpAIO.enabled = false;
        mousePos = Input.GetAxis("Mouse X");
        if (Input.GetAxis("Mouse X") < 0)
        {
            
            if(currentCombNumber >= 20)
            {
                currentCombNumber = 0;
            }
            gameObject.transform.Rotate(0, 18, 0, Space.Self);
            currentCombNumber++;
        }
        else if (Input.GetAxis("Mouse X") > 0)
        {
            if(currentCombNumber <= -1)
            {
                currentCombNumber = 19;
            }
            gameObject.transform.Rotate(0, -18, 0, Space.Self);
            currentCombNumber--;
        }
    }
    private void OnMouseUp()
    {
        fpAIO.enabled = true;
    }

First of all you should actually use the delta that you get from the mouse axis and not just check if it’s anything above or below 0. Then you can simply scale it by any sensitivity value you want. Second you probably want to perform an absolute rotation based on the current value instead of simultaneously rotating the object and hope it keeps synchronised.

First of all change your current combination value from an int to a float, otherwise you can not have a smooth transition.

float currentValue = 0;

Now just do this:

currentValue -= Input.GetAxis("Mouse X") * yourDesiredSensitivity;
currentValue = Mathf.Repeat(currentValue, 20f);
currentCombNumber = (int)currentValue;
gameObject.transform.localRotation = Quaternion.Euler(0,currenValue*18, 0);

Note that this will rotate the gameobject smoothly. If you want it to actually jump to the next position, just use “currentCombNumber” instead. Also when you want to change the number of combinations instead of *18 use *360f/combinationCount