osTeleport Agent

Creating scripts
User avatar
Constance Peregrine
Posts: 2349
Joined: Sun Dec 23, 2012 11:35 am
Has thanked: 2778 times
Been thanked: 1482 times

Re: osTeleport Agent

Post by Constance Peregrine »

I just learned that Lani Global has some issues with her stuff being out of osgrid [unconfirmed but likely something of the truth enough to do this].

So I removed the teleport script I had posted here.

Just trying to avoid issues is all-))
Laissez faire et laissez passer, le monde va de lui même!
My little sounds store https://www.kitely.com/market?store=2040306

Ephemeral wanderer...
User avatar
Mykyl Nordwind
Posts: 22
Joined: Sat Dec 29, 2012 11:05 am
Has thanked: 24 times
Been thanked: 16 times

Re: osTeleport Agent

Post by Mykyl Nordwind »

Dot Macchi wrote:
Mykyl wrote:Also, can anyone explain to me how to figure out the vector for "vector direction = <0,0,0>; " - how do I figure out how to make the avatar face a particular direction?
I'll see if I can find out what vector to use for different compass directions. It'll probably involve inworld experimentation rather than reading about vectors and quaternions.
I have discovered that this is not an absolute direction - it is the location of a "target". Place a prim on the ground which you would like the avatar to face upon arrival and use those x/y/z co-ordinates for the vector. (You can delete the prim once you find the location)
These users thanked the author Mykyl Nordwind for the post (total 2):
Adagio GreenwoodMarstol Nitely
User avatar
Marstol Nitely
Posts: 480
Joined: Mon Dec 24, 2012 1:42 am
Has thanked: 1019 times
Been thanked: 432 times

Re: osTeleport Agent

Post by Marstol Nitely »

Mykyl Nordwind wrote:Also, can anyone explain to me how to figure out the vector for "vector direction = <0,0,0>; " - how do I figure out how to make the avatar face a particular direction?
I never would have figured that one out - thanks Mykyl! Just re-read this a realized I quoted the wrong para. Meant to quote where you discovered what the problem was. :oops: :)
Crystaline Silverblade
Posts: 1
Joined: Wed Jul 30, 2014 2:59 am
Has thanked: 0
Been thanked: 4 times

Re: osTeleport Agent

Post by Crystaline Silverblade »

I know this is an old thread, but it is a top web search result when looking for how to calculate a lookat vector for osTeleportAgent. Since I did not see an answer to this question anywhere, I thought it would be good to share one for the next person that goes looking for it.

After looking around and not finding an answer for calculating a lookat vector for osTeleportAgent, I thought to myself "Hey, maybe it is just a rotation vector around the Z (up) axis". That turned out to be true! So, here is a way to calculate it using LSL script:

Code: Select all

// Whatever angle you want here, using 90 for north.
// Make sure to convert it to radians or it won't work!
float angle = 90.0 * DEG_TO_RAD;
vector lookat = <llCos(angle),llSin(angle),0.0>
The above code will work for any angle, but I also precalculated some common vectors you can just use if you want:

Code: Select all

vector east      = <1.0, 0.0, 0.0>;           // 0 degrees
vector northeast = <0.707107,0.707107,0.0>;   // 45 degrees
vector north     = <0.0, 1.0, 0.0>;           // 90 degrees
vector northwest = <-0.707107,0.707107,0.0>   // 135 degrees
vector west      = <-1.0, 0.0, 0.0>           // 180 degrees
vector southwest = <-0.707107,-0.707107,0.0>; // 225 degrees
vector south     = <0.0, -1.0, 0.0>           // 270 degrees
vector southeast = <0.707107,-0.707107,0.0>;  // 315 degrees
Note for the mathematically inclined people: The vector needs to be normalized. However, the above math will always return a normalized vector, so there is no need to call llVecNorm() on it.

Edit: After more experimentation on my own grid (running OS 0.8), it seems like the lookat vector is only used when teleporting within the same region. When I teleport to another region, I am always facing 0 (East). I don't know if that is because of the region configuration or if it is just the way osTeleportAgent works.
These users thanked the author Crystaline Silverblade for the post (total 4):
Constance PeregrineGraham MillsDot MatrixGhaelen DLareh
Post Reply