Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Can I disable the "sit camera"?

Cerulean Deadlight
Registered User
Join date: 6 May 2007
Posts: 28
02-24-2009 19:36
I'm trying to take most of the avatar's controls while they are seated and I want the camera to stop responding to key presses - it's important that the camera stays where the user has positioned it.

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.
Phate Shepherd
Addicted to code
Join date: 14 Feb 2008
Posts: 96
02-24-2009 22:39
I had the same question very recently. Unfortunately, the best answer thus far was to monitor the camera and attempt to return it back to where it was after the keypress.

Hopefully someone else has a better solution.

I tried playing with the paramaters that control how close the camera has to be to the avi before it snaps back (or so I thought) and didn't have any luck.

I'd love to have the camera unlocked when controls are taken.
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
02-24-2009 23:24
You can provide the participants with a "camera lock" hud.. there's some freebies around that do that basic function.
_____________________

● Inworld Store: http://slurl.eclectic-randomness.com
● Website: http://www.eclectic-randomness.com
● Twitter: @WinterVentura
Cerulean Deadlight
Registered User
Join date: 6 May 2007
Posts: 28
02-24-2009 23:51
I guess that might work, but not very well. Argh.
Thanks