Difference between revisions of "LlClearCameraParams"

From Second Life Wiki
Jump to navigation Jump to search
m
m
 
Line 11: Line 11:
askForPermissions()
askForPermissions()
{
{
    llOwnerSay("I need permissions to control your camera.");
     llRequestPermissions(llGetOwner(), PERMISSION_CONTROL_CAMERA);
     llRequestPermissions(llGetOwner(), PERMISSION_CONTROL_CAMERA);
}
}
Line 37: Line 36:
         else if (!llGetPermissions() & PERMISSION_CONTROL_CAMERA)
         else if (!llGetPermissions() & PERMISSION_CONTROL_CAMERA)
         {
         {
            llOwnerSay("I need permissions to control your camera.");
             askForPermissions();
             askForPermissions();
             return;
             return;

Latest revision as of 06:07, 12 August 2023

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();