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