private void MoveCameraBasedOnInput() { var inputY = _inputProvider.ProvideLookInputY(); var inputX = _inputProvider.ProvideLookInputX(); var clampDirection = CameraClampDirection.none; _accumulatedInputY += inputY; if (_accumulatedInputY > 90f) { clampDirection = CameraClampDirection.up; } else if (_accumulatedInputY < -90f) { clampDirection = CameraClampDirection.down; } _accumulatedInputY = Mathf.Clamp(_accumulatedInputY, -90f, 90f); SetCameraRotationToMaximumAllowedIfNeeded(clampDirection); // Up/down movement needs to be clamped if (clampDirection == CameraClampDirection.none) { transform.Rotate(Vector3.left * inputY); } // But left/right movement does not playerTransform.Rotate(Vector3.up * inputX); }