Here's the script I'm using to test things.
CODE
key avatarKey;
integer startNumberOfPrims = 1;
integer changedNumberOfPrims;
default
{
state_entry()
{
llSitTarget(<0,0,1>, ZERO_ROTATION);
}
changed(integer change)
{
if(change == CHANGED_LINK)
{
changedNumberOfPrims = llGetNumberOfPrims();
if(changedNumberOfPrims > startNumberOfPrims)
{
avatarKey = llAvatarOnSitTarget();
if(avatarKey != NULL_KEY)
{
llRequestPermissions(avatarKey, PERMISSION_TAKE_CONTROLS);
}
}
else
{
llReleaseControls();
}
}
}
run_time_permissions(integer perms)
{
integer desired_controls =
CONTROL_FWD |
CONTROL_BACK |
CONTROL_LEFT |
CONTROL_RIGHT |
CONTROL_ROT_LEFT |
CONTROL_ROT_RIGHT |
CONTROL_UP |
CONTROL_DOWN |
CONTROL_LBUTTON;
if (perms & PERMISSION_TAKE_CONTROLS)
{
llTakeControls(desired_controls, TRUE, FALSE);
}
}
control(key id, integer held, integer change)
{
if (held & change & CONTROL_FWD) llOwnerSay("forward pressed");
else if (held & change & CONTROL_BACK) llOwnerSay("back pressed");
else if (held & change & CONTROL_LEFT) llOwnerSay("left pressed");
else if (held & change & CONTROL_RIGHT) llOwnerSay("right pressed");
else if (held & change & CONTROL_ROT_LEFT) llOwnerSay("rotate left pressed");
else if (held & change & CONTROL_ROT_RIGHT) llOwnerSay("rotate right pressed");
else if (held & change & CONTROL_UP) llOwnerSay("up pressed");
else if (held & change & CONTROL_DOWN) llOwnerSay("down pressed");
else if (held & change & CONTROL_LBUTTON) llOwnerSay("l mouse button pressed");
else if (held & change & CONTROL_ML_LBUTTON) llOwnerSay("l button mouselook pressed");
}
}
As you can see, I have set it so that controls are not passed on, however when an avatar is seated and adjusts their camera any key press will "level" the camera. I don't want this to happen.
Stranger still, when I set pass_on to TRUE, the key presses were not even registering (except right and left I believe).
I have tried llSetCameraEyeOffset(ZERO_VECTOR) and llSetCameraAtOffset(ZERO_VECTOR) and they didn't remove this camera leveling effect.
I also tried taking camera control permissions and then this, but it didn't do anything. I tried it with the camera active and inactive.
CODE
llSetCameraParams([
CAMERA_ACTIVE, 0, // 1 is active, 0 is inactive
CAMERA_FOCUS_LOCKED, FALSE, // (TRUE or FALSE)
CAMERA_POSITION_LOCKED, FALSE // (TRUE or FALSE)
]);
Does anyone have any ideas?
To clarify, I would be ok with the camera orbiting the avatar if the script will still detect all the controls OR I would be ok with the orbiting sit camera disabled but not with the camera leveling whenever a key is pressed.
