Sets multiple camera parameters at once.

Syntax

void llSetCameraParams( list rules );

Forced delay: 0.0 seconds. Energy: 10.0.

Parameters

list rules (instructions)
Format is [ rule1, data1, rule2, data2 . . . rulen, datan ]

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

Constants

RuleParameterDefaultValue RangeDescription
CAMERA_ACTIVE12integer isActiveFALSETRUE or FALSETurns on or off scripted control of the camera.
CAMERA_BEHINDNESS_ANGLE8float degrees10.00 to 180Sets the angle in degrees within which the camera is not constrained by changes in target rotation.
CAMERA_BEHINDNESS_LAG9float seconds0.00 to 3Sets how strongly the camera is forced to stay behind the target if outside of behindness angle.
CAMERA_DISTANCE7float meters3.00.5 to 50Sets how far away the camera wants to be from its target.
CAMERA_FOCUS17vector positionn/an/aSets camera focus (target position) in region coordinates.
CAMERA_FOCUS_LAG6float seconds0.10 to 3How much the camera lags as it tries to aim towards the target.
CAMERA_FOCUS_LOCKED22integer isLockedFALSETRUE or FALSELocks the camera focus so it will not move.
CAMERA_FOCUS_OFFSET1vector meters<0.0,0.0,0.0><-10,-10,-10> to <10,10,10>Adjusts the camera focus position relative to the target.
CAMERA_FOCUS_THRESHOLD11float meters1.00 to 4Sets the radius of a sphere around the camera's target position within which its focus is not affected by target motion.
CAMERA_PITCH0float degrees0.0-45 to 80Adjusts the angular amount that the camera aims straight ahead vs. straight down, maintaining the same distance; analogous to 'incidence'."
CAMERA_POSITION13vector positionn/an/aSets camera position in region coordinates.
CAMERA_POSITION_LAG5float seconds0.10 to 3How much the camera lags as it tries to move towards its 'ideal' position.
CAMERA_POSITION_LOCKED21integer isLockedFALSETRUE or FALSELocks the camera position so it will not move.
CAMERA_POSITION_THRESHOLD10float meters1.00 to 4Sets the radius of a sphere around the camera's ideal position within which it is not affected by target motion.

Caveats

Permissions

Examples

You can either set the camera in region relative coordinates or you can make the camera follow your avatar.

Region relative coordinates, an example:

lookAtMe( integer perms )
{
    if ( perms & PERMISSION_CONTROL_CAMERA )
    {
        vector camPos = llGetPos() + (relCamP * llGetRot() * turnOnChair) ;
        vector camFocus = llGetPos() ;
        llClearCameraParams(); // reset camera to default
        llSetCameraParams([
            CAMERA_ACTIVE, 1, // 1 is active, 0 is inactive
            CAMERA_FOCUS, camFocus, // region relative position
            CAMERA_FOCUS_LOCKED, TRUE, // (TRUE or FALSE)
            CAMERA_POSITION, camPos, // region relative position
            CAMERA_POSITION_LOCKED, TRUE // (TRUE or FALSE)
        ]);
    }
}

Note that Focus and Position are both locked. This first example makes the camera look at camFocus from camPos.

Camera follow avatar, an example:

lookAtMe( integer perms )
{
    if ( perms & PERMISSION_CONTROL_CAMERA )
    {
        llClearCameraParams(); // reset camera to default
        llSetCameraParams([
            CAMERA_ACTIVE, 1, // 1 is active, 0 is inactive
            CAMERA_BEHINDNESS_ANGLE, 30.0, // (0 to 180) degrees
            CAMERA_BEHINDNESS_LAG, 0.0, // (0 to 3) seconds
            CAMERA_DISTANCE, 10.0, // ( 0.5 to 10) meters
          //CAMERA_FOCUS, <0,0,5>, // region relative position
            CAMERA_FOCUS_LAG, 0.05 , // (0 to 3) seconds
            CAMERA_FOCUS_LOCKED, FALSE, // (TRUE or FALSE)
            CAMERA_FOCUS_THRESHOLD, 0.0, // (0 to 4) meters
            CAMERA_PITCH, 10.0, // (-45 to 80) degrees
          //CAMERA_POSITION, <0,0,0>, // region relative position
            CAMERA_POSITION_LAG, 0.0, // (0 to 3) seconds
            CAMERA_POSITION_LOCKED, FALSE, // (TRUE or FALSE)
            CAMERA_POSITION_THRESHOLD, 0.0, // (0 to 4) meters
            CAMERA_FOCUS_OFFSET, <2.0, 0.0, 0.0> // <-10,-10,-10> to <10,10,10> meters
        ]);
    }
}

Note that in this second example Focus and Position are NOT locked and not even set. This is appropriate for making the camera follow a pilot on a vehicle.

See also

Events

Functions

Articles

Deep notes

Issues

Tests