Input system + Cinemachine: how to temporary disable axis?

Previously, without Cinemachine input provied, I was able to temporary nullify input axes - in this sace, freelook continue to follow the target, but can not receive mouse position as the source of moving:

_freeLook.m_XAxis.m_InputAxisName = "";
            _freeLook.m_YAxis.m_InputAxisName = "";

And then, when user is pressing right mouse button, I can reassign default axis names to restore receiving position form mouse. But how can I get same behavior with the new Input System?

Solved by creating custom input provider like this:

using UnityEngine;
using UnityEngine.InputSystem;

namespace Cameras
{
    public class CustomCinemachineInputProvider : Cinemachine.CinemachineInputProvider
    {
        public bool InputEnabled;
        public override float GetAxisValue(int axis)
        {
            if(!InputEnabled)
                return 0;
            return base.GetAxisValue(axis);   
        }
    }
}
3 Likes