Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

How to release the camera by script?

Jim Gustafson
Registered User
Join date: 6 Feb 2007
Posts: 84
05-06-2007 12:51
Hi there,

I am experimenting with the camera settings. I have tried a simple script to set the camera with my script. It all seems to work fine except for the start. If the camera has the focus on another object, the scripted camera will not take over. I have to press ESC first to release my camera. Is it possible to do this by script? I thought llClearCameraParams() should do that?

I could narrow down the problem in this script:

CODE

default
{
state_entry()
{
llSitTarget( < 0, 0, .5 >, ZERO_ROTATION );
}

changed(integer change)
{
if (change == CHANGED_LINK)
{
if (llAvatarOnSitTarget())
{
llOwnerSay("sitting");
llRequestPermissions(llGetOwner(), PERMISSION_CONTROL_CAMERA );
}
}
}

run_time_permissions(integer perm)
{
if ( perm & PERMISSION_CONTROL_CAMERA )
{
llClearCameraParams();
llSetCameraParams([
CAMERA_ACTIVE, 1, // 1 is active, 0 is inactive
CAMERA_FOCUS_LOCKED, TRUE, // (TRUE or FALSE)
CAMERA_POSITION_LOCKED, TRUE // (TRUE or FALSE)
]);
vector new_pos = <0, 0, 0>;
llSetCameraParams( [
CAMERA_POSITION, new_pos ]);
}
}
}


this script sets my camery position to vector <0, 0, 0> (just to test that it works) and it works fine if I just sit on the prim. But if I set the camera position/angle by ALT-Clicking on something, the script don't move the camera.

If I can't release the camera by script, is it possible to detect it in the script if the camera is focused on something else? In this case I can just say in the chat "please press ESC to release your camera".

TIA

Jim
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
05-06-2007 13:03
User Camera setting (via the camera control dialog, or Alt+LClick Focus) overrides scripted camera settings.

That said, since User Camera is completely client-side, there is no way for the server to detect it at the moment (that I know of, anyway).