# llTeleportAgent lookat help

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

## Recommended Posts

Hi there. So, i have been playing around with experiences and i am currently playing around with the llTeleportAgent function. I have used this function many times before but have never been able to properly figure out how you are supposed to set the lookat correctly. I have tried everything from the rotation of the avatar to seeing if it is similar to the lookat on llSitTarget i.e <0,0,270> and yet NOTHING that i try seems to be working. Could someone who is knowledgable on this subject please, very kindly, take the time to explain :

1. How the lookat works exactly (i.e what kind of angle its looking for etc)

2. How you are supposed to figure out what values to put to face a certain direction (because honestly, im stumped)

If someone would take the time to do this i would be so thankful :)

Also, i have already read through the wiki. It was not particularly helpful in helping me understand this section of the function.

##### Share on other sites

In theory, the answer is simple. That final parameter is asking for a regional vector -- the global position for your avatar to look toward when it arrives. So, if you specify <256.0,256.0,0.0>, you should land facing the NE corner of the region. There are several JIRA reports suggesting that people have had trouble making it work, but I have used it successfully myself.  Unfortunately, that parameter does not work if I use llTeleportAgentGlobalCoords.

##### Share on other sites

So....if <256,256,0> is facing NE do you just alter the X and Y values of the vector to achieve the other directions?. Idk why they couldnt just allow you to get the rotation of a object thats facing the way you want to face when you land and use that. So, i may be wrong in understanding this, but if i set to 128,128,0 then i should be facing SW?

##### Share on other sites

So, 256,256,0 does NE where as 128,128,0 does NW yet 192,192,0 does not face north which i would have thought it would do as 192 is halfway between 128 and 256. 192 faces (at a visual guess from minimap) about 10 degree NW of North...

##### Share on other sites

It depends on where you are.  I should have been clearer.  If you specify <256.0,256.0,0.0>, you will end up looking at the position <256.0,256.0,0.0>, which is the NE corner of the region.  If you are in the center of the region, that means you will actually be looking northeast.  However, if you happen to be in the SE corner of the region, at <256.0,0.0,0.0>, you will still be looking at the NE corner, but that will be due north of your current position.   That is, you will be looking north from where you are. The parameter is not asking for a direction.  It's asking for a position to look at.  Does that make sense?

EDIT: This is actually a very handy way for LL to have designed it.  If you want to land looking at your front door, for example, you don't have to calculate the direction from your landing point.  All you have to know is where your front door is.  Put its regional position into that parameter and you'll look at it.

##### Share on other sites

Ahhhhhhhh ok i get you. Why on earth doesn't it just say that on the wiki instead of this

"look_at is not the coordinates of a point in the region. The look_at vector is <llCos(facing), llSin(facing), 0.0> where facing is the angle towards which the arriving avatar is to look."

The above confused me a little as i was like "yes thats all well and good but how do you set theses values and what specifically to..."

Thank you for taking the time to clear that up for me, i greatly appreciate it.

##### Share on other sites

That would be confusing.  Where do you see that note?  When I look in the wiki at http://wiki.secondlife.com/wiki/LlTeleportAgent , I see only

 • vector look_at – The direction the avatar should be turned to face upon arrival.

which is confusing enough because it doesn't define "direction" clearly.

##### Share on other sites

Yep i looked there and also at llTeleportAgentGlobal which is where i pasted that text from.

##### Share on other sites

Oh, my.  Yes, I see it there.  That's interesting.  As I commented earlier, the look_at vector doesn't seem to work in llTeleportAgentGlobalCoords at all. Maybe that's why.  Something is messed up in the way that function interprets the parameter?

In any case, look_at in llTeleportAgent really is a position.  I've been using it that way successfully for more than a year.

##### Share on other sites

Rolig Loon wrote:

Oh, my.  Yes, I see it there.  That's interesting.  As I commented earlier, the look_at vector doesn't seem to work in
llTeleportAgentGlobalCoords
at all. Maybe that's why.  Something is messed up in the way that function interprets the parameter?

In any case, look_at in
llTeleportAgent
really is a position.  I've been using it that way successfully for more than a year.

Tracking through the history of wiki edits for llTeleportAgentGlobalCoords, it loops back to a comment I made to a jira issue describing how I use the look_at vector in my inter-sim walk-thru telepads, which code uses different calculations for inter-sim and intra-sim calls of that -GlobalCoords function. A subsequent jira comment notes that it also behaves differently when the script is in an attachment, compared to freestanding (as in my telepads).

##### Share on other sites

Aha!  That explains it.  Thank you, Qie.  I remember looking at SVC-7987 but didn't look far enough down to read and appreciate your comment.  I wish I had noticed it ages ago.  We really need a note in the wiki.

##### Share on other sites

• 6 years later...

Working with this today, look-at seemed to be a direction. It's coordinate are describe (in a caveat) as

The look_at vector is `<llCos(facing), llSin(facing), 0.0>`

So, the four basic directions are <0.0, 1.0, 0,0>, <1.0, 0.0, 0.0>,<0.0, -1.0, 0,0>, and <-1.0, 0.0, 0.0>

IF that's true, then the example on the LlTeleportAgent page is very misleading.

And then something like <90.0,90.0,0.0> is 45 degrees, it apparently corrects for size. (edited)

(I hope this is well-known, but it's not easy to find hence this entry)

Edited by Christina Halpin
• 1
##### Share on other sites

On 11/7/2022 at 6:14 PM, Christina Halpin said:

Working with this today, look-at seemed to be a direction. It's coordinate are describe (in a caveat) as

The look_at vector is `<llCos(facing), llSin(facing), 0.0>`

So, the four basic directions are <0.0, 1.0, 0,0>, <1.0, 0.0, 0.0>,<0.0, -1.0, 0,0>, and <-1.0, 0.0, 0.0>

IF that's true, then the example on the LlTeleportAgent page is very misleading.

And then something like <90.0,90.0,0.0> is 45 degrees, it apparently corrects for size. (edited)

(I hope this is well-known, but it's not easy to find hence this entry)

I tested this, and yeah, looks like the look_at parameter is always a position the avatar will be facing toward.

So if your landmark is at <100,100,100> and you want to look North (positive Y), look_at should be <100,105,100>. If you used <0,1,0>, you would face the South-West corner. The same applies if no landmark is used and the teleport is only within the local sim.

Wiki could use an update, I'll probably do it tomorrow night.

Edited by Wulfie Reanimator
##### Share on other sites

It's odd that we would have two different experiences. Is that even possible?

Both Firestorm and the SL viewer worked for me as I described -- rotation points in a direction, and <-1.0,0.0,0.0> points me180 degrees from <0.0,0.0,0.0>. ( I was tping to 211, 176, 44).

I was using  llTeleportAgent. Is that the difference? That seems unlikely, because LlTeleportAgentGlobalCoords mentions "The look_at vector is <llCos(facing), llSin(facing), 0.0>".

• 1
##### Share on other sites

On 11/11/2022 at 4:13 AM, Christina Halpin said:

It's odd that we would have two different experiences. Is that even possible?

Both Firestorm and the SL viewer worked for me as I described -- rotation points in a direction, and <-1.0,0.0,0.0> points me180 degrees from <0.0,0.0,0.0>. ( I was tping to 211, 176, 44).

I was using  llTeleportAgent. Is that the difference? That seems unlikely, because LlTeleportAgentGlobalCoords mentions "The look_at vector is <llCos(facing), llSin(facing), 0.0>".

I thought that could've been the difference, but after trying llTeleportAgentGlobalCoords, both functions definitely use look_at as a position instead of a direction. (The avatar will always face a given point regardless of where in the sim they land.)

Both functions were tested on Firestorm and the LL viewer without any difference in behavior. Do you have a script I can review?

This is what I used, it just teleports you 3 meters up while setting the look_at target to a position from local chat:

```default
{
state_entry()
{
llRequestPermissions(llGetOwner(), PERMISSION_TELEPORT);
}

run_time_permissions(integer perm)
{
if(PERMISSION_TELEPORT & perm)
{
llListen(0, "", llGetOwner(), "");
llOwnerSay("Send look-at position in local chat to teleport.");
}
}

listen(integer channel, string name, key id, string message)
{
vector look_at = (vector)message;
integer valid = (look_at != ZERO_VECTOR) || ((string)look_at == message);

if (!valid) return;

llTeleportAgent(llGetOwner(), "", llGetPos() + <0,0,3>, look_at);
// llTeleportAgent(llGetOwner(), "landmark", ZERO_VECTOR, look_at);

// Same behavior:
// vector sim = <232704, 291072, 0>;
// llTeleportAgentGlobalCoords(llGetOwner(), sim, llGetPos() + <0,0,3>, look_at);
}
}```

I've updated the wiki for llTeleportAgent and llTeleportAgentGlobalCoords.

Edited by Wulfie Reanimator
##### Share on other sites

I think teleportation scripts in freestanding objects specifically (as opposed to attachments), using llTeleportAgentGlobalCoords specifically, and teleporting inter-sim specifically behave differently, and they're the ones that need the look_at parameter to specify a direction rather than a position. I have a bunch of walk-through teleporters around the SLRR that have been using that geometry for a long time, so something must be making that work. (They're all Experience-based, but I'm pretty sure I confirmed it with freestanding non-Experience (self-owned)  teleporters, too. This was years ago, though, so I may be forgetting details.)

[ETA: "self-owned" begs for trouble, doesn't it?]

Edited by Qie Niangao
##### Share on other sites

I put your script into a box, agreed to teleport, and the box became transparent (I think). But it did not change my position or ask for input, so it was not a good test.

But I am still inclined to believe your program simply works differently than mine, where these two lines produce a 180  degree difference in rotation

llTeleportAgent( avid, "Dark Art Gallery (Georgiadis)", <0.0,0.0,0.0>, <0.0,0.0,0.0>);
llTeleportAgent( avid, "Dark Art Gallery (Georgiadis)", <0.0,0.0,0.0>, <-1.0,0.0,0.0>);

Could you be teleporting within a region?

(The string is  a landmark in my obect's inventory.)

• 1
##### Share on other sites

4 hours ago, Christina Halpin said:

I put your script into a box, agreed to teleport, and the box became transparent (I think). But it did not change my position or ask for input, so it was not a good test.

...how...

4 hours ago, Christina Halpin said:

But I am still inclined to believe your program simply works differently than mine, where these two lines produce a 180  degree difference in rotation

llTeleportAgent( avid, "Dark Art Gallery (Georgiadis)", <0.0,0.0,0.0>, <0.0,0.0,0.0>);
llTeleportAgent( avid, "Dark Art Gallery (Georgiadis)", <0.0,0.0,0.0>, <-1.0,0.0,0.0>);

Could you be teleporting within a region?

(The string is  a landmark in my obect's inventory.)

The second command, using look_at <-1.0,0.0,0.0>, points me toward the South-West corner (not West as we should expect). All of these point me toward that corner:

• < 1.0, 0.0, 0.0>
• <-1.0, 0.0, 0.0>
• < 0.0, 1.0, 0.0>
• < 0.0,-1.0, 0.0>

Edit: Oh, now I get the behavior. If the teleport would cause the avatar to enter a different sim, that's when look_at behaves as a direction. If the teleport happens within the sim (for llTeleportAgent or llTeleportAgentGlobalCoords), look_at acts as a position. Neither wiki page specified this, now they do.

Edited by Wulfie Reanimator
• 2
• 1