help with raycastall

bare with me, i will try to explain what i need, please

i have this simple structure of objects:

object child 1 child 2

so what i was trying is to check visibility (can the object be seen from given camera angle) of the children objects by casting a ray from camera and trying to figure is the first element in the array of hits is parent object or one of the children. but it works only for children that are on the bottom side of the parent (with y less then zero), and i can not figure out why?!

i am using the coordinates of the children converting them to screen space and using that for GUI labels. if objects are not visible, gui label still renders and that is not what i want

so when i rotate camera if children are not first hit then i made then invisible and if they are first hit then i make them visible.

here is the code i use for checking the visibility of children.

function CheckVisibility(target : Vector3) : boolean {

    var hits : RaycastHit[];
    var direction : Vector3;
    var origin : Vector3;
    var distance : float;

    //ORIGIN : CAMERA POSITION
    origin=camScript.transform.position;

    //DIRECTION VECTOR
    direction=target-origin;

    //DISTANCE FROM ORIGIN(CAMERA) TO  TARGET
    distance=Vector3.Distance(origin,target);

    //NORMALIZE DIRECTION
    direction.Normalize();

    //RENDERES RAY IN EDITOR
    Debug.DrawRay(origin,direction);

    //ALL HITS WE HAVE
    hits=Physics.RaycastAll(origin,direction,distance);

    for(i=0;i<hits.length;i++){
        //DISREGARD COLLIDER OBJECT 
        if(hits*.collider.name!="ColliderObject"){*
 *//IF FIRST OBJECT IN THE ARRAY IS NOT*
 *//THE CURRENTLY SELECTED OBJECT*
 *//RETURN TRUE BECAUSE OBJECT IS VISIBLE*
 *if(hits[0].collider.name!=camScript.currentTarget.name){*
 *return true;* 
 *} else {*
 *return false;*
 *}*
 *}* 
 *}*
*}*
*```*
*<p><img src="http://img404.imageshack.us/img404/8892/rayy.png" alt="alt text"></p>*

I do not think RaycastAll returns the hits in order. You will need to check for that yourself

float closestDist = float.MaxValue;
string closestName = "";
hits=Physics.RaycastAll(origin,direction,distance);
for(i=0;i<hits.length;i++)
{
    if(hits*.collider.name != "ColliderObject")*
 *{*
 _if(hits*.distance < closestDist)*_
 _*{*_
 <em>_closestDist = hits*.distance;*_</em>
 <em><em>_closestName = hits*.collider.name;*_</em></em>
 <em><em>_*}*_</em></em>
 <em><em>_*}*_</em></em>
<em><em>_*}*_</em></em>
<em><em>_*if(closestName == "")*_</em></em>
 <em><em>_*return false;*_</em></em>
<em><em>_*return hits[0].collider.name != camScript.currentTarget.name;*_</em></em>
<em><em>_*```*_</em></em>
<em><em>_*<p>Or something close to that anyway.</p>*_</em></em>