Linecast Layer Mask Declaration Problem

var awareness:float;
var aiOwner:GameObject;
function OnTriggerStay(other : Collider) {
if(other.gameObject.tag =="Player"&&!Physics.Linecast (aiOwner.transform.position,other.transform.position,2)){

other.GetComponent("DetectionScript").NoticedPlaya(awareness);

}
}

My scene looks like this

O=======

O is a waypointed AI and ======= are certain triggers for visibility , havign the code above.aiOwner of each trigger is set to the "O"Waypointed AI gameobject The code above uses linecast with the layer mask being 2 for IgnoreRaycast which the triggers have as their layer. The problem is that the linecast doesnt work and its being negative , even when a wall is between the player and the AI , without having set 2 as the linecast's ignore layer, the linecast from the AI hits the triggers and always returns true. Any ideas on how to solve this?

EDIT: OBVIOUSLY im declaring the layer falsely , can someone give me a proper example of how to do it properly?

EDIT 2: after declaring the layer with a valid way , still the problem persists , also , the position where the game thinks aiOwner is isnt at the relative position of the capsule to its parent , it appears its completely random ,its at position

X=30611.73
Y=-6522.702
Z=11684.97

http://img715.imageshack.us/img715/3140/linecastproblem.png

Got it fixed

    var layerMask : int = 1 << 2;
layerMask=~layerMask;
var awareness:float;
//var aiOwner:Transform;
var hit:RaycastHit;
function OnTriggerStay(other : Collider) {

if(other.gameObject.tag =="Player" && !Physics.Linecast (other.transform.position,transform.parent.position, layerMask)){
other.GetComponent("DetectionScript").NoticedPlaya(awareness);
Debug.DrawRay (transform.parent.position* 10,other.transform.position, Color.green);

}
}

You need to use a LayerMask. I imagine what you're looking for is

if(other.gameObject.tag =="Player" && !Physics.Linecast (aiOwner.transform.position, other.transform.position, LayerMask (2)))

If you want to do the math yourself, there are instructions here. In that case you'd use

var layerMask : int = 1 << 2;
if(other.gameObject.tag =="Player" && !Physics.Linecast (aiOwner.transform.position, other.transform.position, layerMask))