Difference between revisions of "LlGetCameraFOV"

From Second Life Wiki
Jump to navigation Jump to search
(fix syntax error in script: touch_start event needs one integer argument)
m (Replaced <source> with <syntaxhighlight>)
 
Line 11: Line 11:
|caveats=Returns zero when permissions have not been granted.
|caveats=Returns zero when permissions have not been granted.
|examples=
|examples=
<source lang="lsl2">// say the camera aspect ratio and field of view (FOV)
<syntaxhighlight lang="lsl2">// say the camera aspect ratio and field of view (FOV)
integer has_perms = FALSE;
integer has_perms = FALSE;
default
default
Line 41: Line 41:
         }
         }
     }
     }
}</source>
}</syntaxhighlight>
|helpers
|helpers
|also_functions=
|also_functions=

Latest revision as of 08:30, 14 March 2024

Summary

Function: float llGetCameraFOV( );

Returns a float value for the current camera's field of view (FOV), in radians, of the agent for which the task has permissions.

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

Caveats

Permissions
Returns zero when permissions have not been granted.
All Issues ~ Search JIRA for related Bugs

Examples

// say the camera aspect ratio and field of view (FOV)
integer has_perms = FALSE;
default
{
    on_rez(integer a)
    {
        llResetScript();
        has_perms = FALSE;
    }
    state_entry()
    {
        llRequestPermissions(llGetOwner(), PERMISSION_TRACK_CAMERA);
    }
    run_time_permissions(integer permission)
    {
        has_perms = (permission == PERMISSION_TRACK_CAMERA);
    }
    touch_start(integer num_touches)
    {
        if (has_perms)
        {
            float aspect = llGetCameraAspect();
            float fov = llGetCameraFOV();
            llOwnerSay("aspect = " + (string)aspect + "  FOV = " + (string)fov);
        }
        else
        {
            llRequestPermissions(llGetOwner(), PERMISSION_TRACK_CAMERA);
        }
    }
}

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
•  llGetCameraAspect
•  llGetCameraPos
•  llGetCameraRot
•  llSetCameraParams
•  llSetCameraAtOffset
•  llSetCameraEyeOffset

Articles

•  Script permissions

Deep Notes

Search JIRA for related Issues

Signature

function float llGetCameraFOV();