Cinemachine input axis camera movement,cinemachine input axis control with script

Hello, I am new to cinemachine and am trying to make a camera movement using cinemachine free look camera where it will follow the player behind but when right-click is pressed the camera will be free to rotate and orbit the player. After right-click is released then it will snap back to its original position behind the player.

I think I need use the variables “Input Axis Name” for the X and Y axis in the Axis Control and have then set when the right-click button is pressed or released. However I am not sure how to get these variables in a script. Any help is appreciated.

I recognize that this question is probably long dead, but I had a similar question just the other day. I think I’ve found a solution that the both of us were looking for.

Make sure you put using Cinemachine; at the very top of your script. Then just copy/paste this in.

void Start()
   {
	   CinemachineCore.GetInputAxis = GetAxisCustom;
   }

public float GetAxisCustom(string axisName)
	{
        if(axisName == "Mouse X")
		{
            if (Input.GetKey("mouse 1"))
			{
                return UnityEngine.Input.GetAxis("Mouse X");
            } 
			else
			{
                return 0;
            }
        }
        else if (axisName == "Mouse Y")
		{
            if (Input.GetKey("mouse 1"))
			{
                return UnityEngine.Input.GetAxis("Mouse Y");
            } else
			{
                return 0;
            }
        }
        return UnityEngine.Input.GetAxis(axisName);
    }