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);
}
}
}
