So, im playing around with a new idea i had. I want to detect avatars that are within 2 Meters infront of me without using a Sensor. So far i have used llGetAgentList to do this and have set a condition so it only returns people within 2 Meters of me BUT it returns everyone within 2 Meteres within 360 degrees of me. So if someone is stood behind me it will stick pick them up. So what i want to do is have my script only detect other avatars that are standing infront of me, inside a 45 degree angle. So a similar shape to this \ / . And are no further away than 2 meters. My code is as follows : list avatars=[];
integer i;
av(){
avatars=llGetAgentList(AGENT_LIST_REGION,[]);
i=-1;
while(++i<llGetListLength(avatars)){
vector pos=(vector)llList2String(llGetObjectDetails((key)llList2String(avatars,i),[OBJECT_POS]),0);
vector pos2=llGetPos()+<0,0,0>*llGetRot();
vector pos3=pos2-pos;
if(llVecDist(pos,llGetPos())<2){
if((key)llList2String(avatars,i)!=llGetOwner()){
//This section is the section that needs to only detect avatars in front of me within the 2 meter / 45 degree range
llOwnerSay(llKey2Name((key)llList2String(avatars,i))+" is within range");
llOwnerSay("Pos3 is : "+(string)pos3);
}
}
}
}
default{
touch_start(integer x){
av();
}
}As you can see i have made some attempts already with the pos, pos2, pos3 and have tried a variety of other ideas but i just can not seem to crack this. Would someone kindly be of help to me?