Free Look with new input system?

i did this same exact thing using the new input system with this code

    public class CameraManager : MonoBehaviour
    {
        private DefaultControls defaultcontrols; //default controls is just the Csharp code you generate from the action maps asset
        private Vector2 LookDelta; 
        public bool Lockon; //this would be used to switch to a virtual camera for a lockon system

        private void Awake() => defaultcontrols = new DefaultControls();

        private void OnEnable() => defaultcontrols.TPController.Enable();
        private void OnDisable() => defaultcontrols.TPController.Disable();

        private void Update()
        {
            CinemachineCore.GetInputAxis = GetAxisCustom;
        }

        public float GetAxisCustom(string axisName)
        {
            LookDelta = defaultcontrols.TPController.Camera.ReadValue<Vector2>(); // reads theavailable camera values and uses them.
            LookDelta.Normalize();

            if (axisName == "Mouse X")
            {
                return LookDelta.x;
            }
            else if (axisName == "Mouse Y")
            {
                return LookDelta.y;
            }
            return 0;
        }
    }

then all you have to do is MAKE SURE that whatever is controlling your Camera action is set as Value/Vector (i beat my head against a wall for 3 days bc of this)

2 Likes