Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Problem with llSetPos

Kaylan Draken
Registered User
Join date: 2 Dec 2006
Posts: 127
04-14-2008 14:39
Can anyone help me with this problem?
i made a script for a chair when you touch it the chair goes to about 50m high and then eject the person and then the chair goes back to home position.

The script works except the part when the chair goes back to home position.
Sometimes it goes back but often the chair goes back to about 36m high and i don't understand why.

First i tried to set home position with llGetPos and later hard coded the home position.

i have also a 2e question:
Sometimes the camera follows the avatar when it goes up and other times the camera stays at home position. does any one now how i can change it that the camera always follows the avatar?

Thanks

<CODE>
vector Home=<16.0, 20.0, 21.3>;
vector Position;
float Height;
key Av;

default
{
state_entry()
{
//Home=llGetPos();
llSetStatus(STATUS_PHYSICS, FALSE);
llSitTarget(<0.07, 0.2, -0.25>, <0.0, 0.0, 0.85, 1.0>;);
}

touch_start(integer total_number)
{
llSetStatus(STATUS_PHYSICS, TRUE);
llSetBuoyancy(1.2);
llSetTimerEvent(1.0);
}

changed(integer change)
{
if (change & CHANGED_LINK)
{
if (llAvatarOnSitTarget() != NULL_KEY)
{
Av=llAvatarOnSitTarget();
}
}
}

timer()
{
Position=llGetPos();
Height=Position.z;

if (Height > 50.0)
{

llUnSit(Av);
llSetStatus(STATUS_PHYSICS, FALSE);
llSleep(2.0);
llSetPos(Home);
llSetTimerEvent(0);
}
}
}
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
04-14-2008 14:52
llSetPos moves a maximum of 10m on any axis per call.

You need to call it multiple times or use WarpPos instead.
Kaylan Draken
Registered User
Join date: 2 Dec 2006
Posts: 127
04-14-2008 22:22
Thanks Talarus didn't know that.:)
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
04-14-2008 23:56
The camera will follow the avatar up if the focus is set on the avatar (alt left clicking the avatar before going up). If the focus is on something else, the cam won't follow. You'll need to ask for permission to take cam controls, then force the cam focus, or force mouselook to solve your problem.
Kaylan Draken
Registered User
Join date: 2 Dec 2006
Posts: 127
04-16-2008 10:57
Thanks Johan and Talarus for your answer.
I solved it with warpPos but have to look further in cam control or mouselook.