Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Help on simple teleporter

TiGuy Goalpost
Registered User
Join date: 18 Nov 2006
Posts: 12
05-04-2008 18:12
Hi,

I want to script a simple teleporter to carry me on my parcel. So far it's only a test script. On click it's supposed to teleport me to a specific target (around 50 meters beside the position of the object). It works, but on arrival to my target position, my avi start flying all over the place for one or 2 seconds. And since I'm on the top of a skybox at 700m above ground, I flip over the edge and fall. If I set the target far away from the edge, I don't fall, but when my avi arrives to the target, he's floating (flying above the top of the skybox).

I suspect that it's because I TP up in the sky, maybe it detects that I'm above the ground and starts flying... Then, how can force my avi in a "no flying" mode once I unsit him?

Thanks in advance for your help.

Here is the script:


vector LandingStripTgt = <96,34,701>; // the Target Vector for the middle of the landing strip


default
{
// At the start of the Default state, this block of code is executed
state_entry()
{
llSetText("Simple teleporter",<255,255,255>,1); // Set the text displayed above the teleporter
}

touch_start(integer total_number)
{
vector ActualPosition = llGetPos();
llOwnerSay("TP actual position is "+ (string)ActualPosition);
vector OffsetPos = LandingStripTgt - ActualPosition;
llOwnerSay("The offset to the target is: "+(string)OffsetPos);
llSitTarget(OffsetPos,ZERO_ROTATION);
llSetSitText("Teleport";);
llOwnerSay("Teleporter activated and ready, right click and select <Teleport> to get to the destination";);
}

changed(integer change)
{
llUnSit(llAvatarOnSitTarget()); // The Avi is unsitted, because we only wanted to TP him, not sit him..
}


}
Anti Antonelli
Deranged Toymaker
Join date: 25 Apr 2006
Posts: 1,091
05-04-2008 18:17
Try adding a sleep to pause just a bit before unsitting. Like this:

changed(integer change)
{
llSleep(0.5);
llUnSit(llAvatarOnSitTarget());
}

I'm not sure technically why it works, but it seems to help sometimes. Maybe avatars gain some "momentum" during sit-teleports if it all happens too quickly...
_____________________
Designer of sensual, tasteful couple's animations - for residents who take their leisure time seriously. ;)

http://slurl.com/secondlife/Brownlee/203/110/109/

TiGuy Goalpost
Registered User
Join date: 18 Nov 2006
Posts: 12
It works!!
05-04-2008 18:32
I did as you suggested and it works just fine now. Damn... I've lost a lot of time trying to make it work and the solution was so simple...

Thanks a lot!!