06-06-2007 19:18
I'm writing a standard teleporter script using the usual llSitTarget hack. However, I find that the camera doesn't always follow the AV to the new position. The effect seems random. In any event, I thought of putting some code into my script that would reset the camera after the teleport either before or after the unsit. But I can't get it to work.

the relevant code is:

changed(integer change)
{
if (change & CHANGED_LINK)
{
key avkey = llAvatarOnSitTarget();
llSleep(0.3);
if (avkey != NULL_KEY)
{
llUnSit(avkey);
llRequestPermissions(avkey,PERMISSION_CONTROL_CAMERA);
}
}
}

run_time_permissions(integer perm)
{
llSay(0,"Default Camera";);
if ( perm & PERMISSION_CONTROL_CAMERA )
{
llClearCameraParams();
llSetCameraParams([CAMERA_ACTIVE, 1]);
}
}

If I put the llRequest... where it is above, run_time_permissions does not appear to be called, or at least the llSay is never chatted. If I move it anywhere before the llUnsit, I get a run time error complain that I'm trying to clear camera parameters without permission.

What am I doing wrong?

I tried reading all the info on the lslportal and lslwiki but I still don't feel like I understand all this camera stuff. Can anyone point my to a good tutorial or manual for this?