Jump to content

the fastest radar


Xander Lopez
 Share

You are about to reply to a thread that has been inactive for 1533 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I am trying to create a radar which displays the distance between myself and my target avatar. (and also the target avatar's name thru llKey2Name)

Here is the question.  I think sensor is a thing of the past.  Everyone talks about using http://wiki.secondlife.com/wiki/LlGetAgentList

Though, I am not sure if i am on the right track.

Would it make sense to use llGetAngetList to scan the target avatar, and calculate its distance every 0.1 seconds with timer event?? How should I start with the concept of creating this with the most lagless way?

 

Link to comment
Share on other sites

Sensors can be laggy because the sim needs to "sort" through a lot of objects to figure out 1) which are within range and 2) match the filters set for the sensor. GetAgentList just gives your script an exact copy of the avatars currently known to the sim. Very fast in comparison, even for 100+ avatars, plus you aren't limited by distance.

But first ask yourself: How crucial is it for me to know the exact distance between myself and the target(s)?

An update rate of 0.1 seconds seems pretty unnecessary if it's just a distance to be shown to the user and not for anything else. Try every second or half-second.

You probably won't need to update the agent list every time you're going to check distances if it's just a general radar either, you could get the agent list every few "updates." (For example, if you update every second, update the list every third or fifth second.)

Link to comment
Share on other sites

once the script has acquired the target avatars key (uuid) then thereafter we only need to check for the presence of the target uuid in the timer event

example

key target;

timer()
{
   if (target)  // != NULL_KEY
   {
      if (llGetAgentSize(target)) // != ZERO_VECTOR
      {
          ... do stuff to target ...

          return;
      }
      // target is not on region
      target = NULL_KEY;
   }

   ... acquire a new target ... with llGetAgentList for example ...
}

 

Link to comment
Share on other sites

7 hours ago, Mollymews said:

once the script has acquired the target avatars key (uuid) then thereafter we only need to check for the presence of the target uuid in the timer event

And once you have an avatar's UUID, you can always determine position and distance with 

vector vAvPos = llList2Vector(llGetObjectDetails(UUID,[OBJECT_POS]),0);

and then

float fDist = llVecDist(llGetPos(),vAvPos);

so you don't have to keep re-acquiring llGetAgentList very often at all. Every few seconds should be enough unless you are in a busy region where there are a lot of people coming and going all the time.

  • Like 2
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1533 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...