Jump to content

Detecting avatar uuid when you are looking at the av in mouselook mode


Xander Lopez
 Share

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

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

Recommended Posts

How can I start about creating a script that detects the avatar's uuid when you are looking at the avatar in mouselook mode?

Let's say that I go into the mouselook mode.  I pan my cam around and see an avatar about 30 meters away from me.  I would like to figure out a way to somehow detect that avatar's uuid automatically without having to click mouse button. And I hope wouldn't have to use the llcastray because llcastray shoots such tiny beam that the chance of it detecting avatar is too slim...

 

Is this even possible? which function should I start to look at?

 

Link to comment
Share on other sites

1 minute ago, Xander Lopez said:

How can I start about creating a script that detects the avatar's uuid when you are looking at the avatar in mouselook mode?

Let's say that I go into the mouselook mode.  I pan my cam around and see an avatar about 30 meters away from me.  I would like to figure out a way to somehow detect that avatar's uuid automatically without having to click mouse button. And I hope wouldn't have to use the llcastray because llcastray shoots such tiny beam that the chance of it detecting avatar is too slim...

 

Is this even possible? which function should I start to look at?

 

If you absolutely want to avoid llCastRay and the land has rezzing enabled, you could have an object that follows your camera's position/rotation, and uses llSensor.

Otherwise you're stuck with a timer and multiple llCastRay calls, so you can create a cone-shaped detection area.

Link to comment
Share on other sites

11 hours ago, Xander Lopez said:

Is this even possible? which function should I start to look at?

It is and there are 2 methods:
The first uses llSensor("","",1,FOV,96.0); The limitation of this method is it only works within 96m of where you are but it is the easiest to program and less-region intensive.
The second involves llGetAgentList and a lot of math. Not recommended but it's able to work across an entire region and it can even work in 3rd person.

Something of note is that some TPVs have this built into their client and it is recommended you use that over something scripted.

Edited by Secondary Lionheart
Link to comment
Share on other sites

21 hours ago, Secondary Lionheart said:

It is and there are 2 methods:
The first uses llSensor("","",1,FOV,96.0); The limitation of this method is it only works within 96m of where you are but it is the easiest to program and less-region intensive.
The second involves llGetAgentList and a lot of math. Not recommended but it's able to work across an entire region and it can even work in 3rd person.

Something of note is that some TPVs have this built into their client and it is recommended you use that over something scripted.

I would say llSensor is way worse than llGetAgentList, even if you have to do a bit of math yourself. For example:

integer CastCone(key id, vector direction, float radius, float arc)
{
    vector start = llGetPos();
    vector target = llList2Vector(llGetObjectDetails(id, (list)OBJECT_POS), 0);

    if (llVecMag(target - start) > radius)
        return (FALSE);

    rotation rot = llRotBetween(direction, target - start);
    float angle = llRot2Angle(rot);

    if (angle > arc)
        return (FALSE);

    return (TRUE);
}

This is llSensor without an actual sensor (or distance limits), but it only detects a specific target by UUID (which you would get from llGetAgentList). You could add a llCastRay into/after this to check if there is line of sight.

Edit: 

 

 

Edited by Wulfie Reanimator
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1108 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...