Pick up GameObject with Linecast/Raycast

Hello,

i’v a problem with right way to pick up game objects with ray-/linecast.

scenario :

2 cubes (one smaller than the other) above each other (with space between).
A crosshair (EmptyGameObject) as child of FPS controller camera (in center of screen)

Problem :

I don’t know how exactly i can pick up the box the crosshair is facing to. I have tried with raycast and linecast but it is not working correctly.

This snippet is part of a script added to crosshair

Vector3 playerPosition = gameObject.transform.position;
RaycastHit raycastHit;
Vector3 target = playerPosition + Camera.main.transform.forward * Range; // Range i can set in editor ex. 2

    if (Physics.Raycast (playerPosition, target, out raycastHit)) 
    {
        Debug.DrawLine( Camera.main.transform.position, raycastHit.point, Color.red, 0, false);
        canHover = true;
        return raycastHit.collider.gameObject;
    }

If the player is close to the boxes only one of the boxes (in this case the box on top) i can “trigger”. i can look around, the crosshair is “touching” the bottom box or the ground or whatever, always the box on top is “touching” by ray-/linecast. The picture is showing what i mean. You can see, the crosshair (little white dot) is on the bottom box (Game view window) but the debug line is facing the top box (red line in Scene view and DebugOutput in GameView). If i move the mouse around, the red line is moving too, so i think that is correct working but if the player is close to the boxes the red line never goes to the bottom box or ground.
I need a way to get only the box (or whatever) where the crosshair is. In this case, is the crosshair “over” the bottom box, i want only pick up the bottom box, is the crosshair over the top box i want only pick up the top box, is the crosshair between the boxes i don’t want to pick up anything, and so on. In short, i need a way to select exactly that object the crosshair is over.

If picrure is not showing, the pic is in my google drive :
https://drive.google.com/file/d/0B91KsdUZnHAsUlhOQUlzX3pBdWs/view

I hope my english is understandable.
Regards and thx for help

You probably want to raycast from the center of the screen then, and not from the player position.

Try something like this

Ray ray = Camera.ScreenPointToRay(new Vector3(Screen.width / 2f, Screen.height / 2f, 0f);
if (Physics.Raycast(ray, out raycastHit))
{
    // Yay, we hit something
}