llClearCameraParams

From Second Life Wiki
(Redirected from LSL llClearCameraParams)
Jump to navigation Jump to search

Summary

Function: llClearCameraParams( );
0.0 Forced Delay
10.0 Energy

Resets all camera parameters to default values and turns off scripted camera control.

To run this function the script must request the PERMISSION_CONTROL_CAMERA permission with llRequestPermissions.

Caveats

Permissions
  • The PERMISSION_CONTROL_CAMERA permission is automatically revoked when the avatar stands up from or detaches the object, and any scripted camera parameters are automatically cleared.

Examples

integer gEnabled;

askForPermissions()
{
    llRequestPermissions(llGetOwner(), PERMISSION_CONTROL_CAMERA);
}

default
{

    on_rez(integer sp)
    {
        llResetScript();
    }

    state_entry()
    {
        askForPermissions();
    }

    touch_start(integer total_number)
    {

        if (llDetectedKey(0) != llGetOwner())
        {
            return;
        }
        else if (!llGetPermissions() & PERMISSION_CONTROL_CAMERA)
        {
            llOwnerSay("I need permissions to control your camera.");
            askForPermissions();
            return;
        }

        gEnabled = !gEnabled;
        if (gEnabled)
        {
            llOwnerSay("Enabled.");
            llSetCameraParams([
                CAMERA_ACTIVE, 1, 
                CAMERA_DISTANCE, 50.0
            ]);
        }
        else
        {
            llOwnerSay("Disabled.");
            llClearCameraParams();
        }

    }

}

See Also

Events

•  run_time_permissions Permission receiving event

Functions

•  llGetPermissions Get the permissions granted
•  llGetPermissionsKey Get the agent who granted permissions
•  llRequestPermissions Request permissions
•  llSetCameraParams

Articles

•  Script permissions

Deep Notes

Signature

function void llClearCameraParams();