Difference between revisions of "LlClearCameraParams"

From Second Life Wiki
Jump to navigation Jump to search
m
 
(8 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{LSL_Function|func_id=314|func_sleep=0.0|func_energy=10.0|sort=ClearCameraParams|func=llClearCameraParams|func_desc=Resets all camera parameters to default values and turns off scripted camera control.|return_text|spec|caveats|constants|examples|helpers|also_functions|also_events|also_articles|notes|permission=PERMISSION_CONTROL_CAMERA}}
{{LSL_Function/permission|PERMISSION_CONTROL_CAMERA}}{{LSL_Function
{{LSLC|Stub|ClearCameraParams}}
|func_id=314|func_sleep=0.0|func_energy=10.0
{{LSLC|Camera|ClearCameraParams}}
|func=llClearCameraParams
|func_desc=Resets all camera parameters to default values and turns off scripted camera control.
|return_text
|spec
|caveats
|constants
|examples=<source lang="lsl2">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();
        }
 
    }
 
}</source>
|helpers
|also_functions={{LSL DefineRow||[[llSetCameraParams]]}}
|also_events
|also_articles
|notes
|cat1=Camera
|cat2
|cat3
|cat4
}}

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