Advertisement
Gayngel

Detecting av within area of polygon

Dec 26th, 2019
1,216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Create 2 prims and color one red and the other green. The red prim is the NORTH_EAST_CORNER and should be positioned in the NORTH_EAST_CORNER on the "roof" or "ceiling" of the area you want to scan. The green prim is the SOUTH_WEST_CORNER and should be positioned in the SOUTH_WEST_CORNER on the "floor" of the area you want to scan.
  2.  
  3. vector NORTH_EAST_CORNER=<223.95860, 29.33944, 2706.80542>;
  4.  
  5. vector SOUTH_WEST_CORNER=<208.70197, 14.07825, 2700.38452>;
  6.  
  7.  
  8.  
  9. default
  10. {
  11.     state_entry()
  12.     {
  13.         llSetTimerEvent(1.0);
  14.     }
  15.  
  16.     timer()
  17.     {
  18.         llSetTimerEvent(0.0);
  19.        
  20.         list keys=llGetAgentList(AGENT_LIST_PARCEL,[]);
  21.  integer total=llGetListLength(keys);
  22.  integer idx = 0;
  23.    
  24.   for(idx=0;idx<total;++idx)
  25.     {
  26.         key av=llList2Key(keys,idx);
  27.         list params=llGetObjectDetails(av,[
  28.                 OBJECT_POS
  29.             ]);
  30.         vector AvPos=(vector)llList2String(params,0);
  31.  
  32.     if
  33.     (AvPos.x > SOUTH_WEST_CORNER.x & AvPos.x < NORTH_EAST_CORNER.x & AvPos.y > SOUTH_WEST_CORNER.y & AvPos.y < NORTH_EAST_CORNER.y & AvPos.z > SOUTH_WEST_CORNER.z & AvPos.z < NORTH_EAST_CORNER.z)
  34.      {
  35.      llOwnerSay(llKey2Name(av) + " has entered the area");
  36.      }
  37.         }
  38.        
  39.        
  40.         llSetTimerEvent(1.0);
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement