How take item if I am bringing rear sight and press key E?

I want take item if I am bringing rear sight and press key E.

I add trigger for Item

//item.cs

public void OnTriggerStay(Collider other){
  if (other.tag == "Player"){
    Inventory.GetInventory().TakeItem();   
  }
}

//inventory.cs

public void TakeItem(){
		RaycastHit hit;
	    Ray ray = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));

		if (Input.GetKeyDown (KeyCode.E)) {
            if (Physics.Raycast(ray, out hit)){
					Item item = hit.transform.GetComponent<Item>();
					if (item != null){
					    item.audioTakeItem.Play();
					    items.Add(item);
						item.gameObject.SetActive(false);
					}
			}
		}
	}

But this code wrong. I can take item if rear sight in not directed item.

Sorry my wrong English =)

So I’ve made it like this and it works just as expected.

using UnityEngine;
using System.Collections;

public class RayCaster : MonoBehaviour {

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		if (Input.GetKeyDown (KeyCode.E)) {
			Debug.Log ("Pressed E");
			Ray ray = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));
			RaycastHit hit;
			if (Physics.Raycast(ray, out hit))
			{
				if(hit.distance < 1f)	hit.collider.gameObject.SendMessage("Destroy");
			}
		}
	}
}

Figure out by yourself how to make the rest of logic.