Mouse position goes out of game view.

I am getting a mouse position using the New Input System.

I want to rotate the character to the mouse position. However, the mouse position detects out of the game view, so normal rotation is impossible.

Input Debugger’s ‘Lock Input To Game View’ option is also ineffective.

I spent a lot of time because of the New Input System. I want to finish this problem. Is there anyone who can help you?

            #region aiming position
            playerControls.PlayerMovement.Aiming.performed +=
                context =>
                {
                    aimingInputs = context.ReadValue<Vector2>();
 
                    Vector3 worldPos = Vector3.zero;
                    worldPos.x = aimingInputs.x;
                    worldPos.z = aimingInputs.y;

                    Vector3 tempPos = Camera.main.ScreenToViewportPoint(worldPos);

                    Vector3 currentPos = transform.position;

                    Vector3 dirToTarget = worldPos - currentPos;

                    Quaternion targetRotation = Quaternion.LookRotation(dirToTarget);
                    Quaternion playerRotation = Quaternion.Slerp(transform.rotation, targetRotation, 20f * Time.deltaTime);
                    transform.rotation = playerRotation;
                 };
            #endregion

1; do not test these things in the editor, ever
2; even if the mouse is out of the game view, rotation should be possible, why wouldn’t be?

Luckily you can’t lock yourself out of the editor window and in the game view.

The character rotates in the game view.
But it’s rotating according to the ratio based on my monitor size.

Ex. Monitor Top Left to Top Right : Character Left to Right Rotation