CamHUD ( V1 )

Written by Kitsune

Simple two function scripted camera controller. When turned on, the camera position locks in whatever place it was at the time of activation. To change the camera position, turn the HUD off...move the camera to the desired position...turn the HUD back on.

    https://d1yjxggot69855.cloudfront.net/skins/monobook/bullet.gif); ">
  • There are two buttons - One marked "Track" and another marked "Power".
      https://d1yjxggot69855.cloudfront.net/skins/monobook/bullet.gif); ">
    • "Power" (I think) has a fairly obvious function.
    • "Track" switches on and off, tracking of the owner. With tracking off the camera is locked solid. With tracking on the camera position is locked but it rotates to follow you around if you move.

The usefulness of this is up to you to decide.

 

Create the Object

 

To create the object use the following script. Just drop it onto/into a fresh prim. The resulting prim is quite small since it is designed to be a low impact HUD.

 

// V1 //
 
default
{
    state_entry()
    {
        llSetObjectName("CamHUD"); // You can change this after if you want.
        llSetPrimitiveParams([7, <0.01, 0.05, 0.025>,
                              8, <1.0, 0.0, 0.0, 0.0>,
                              9, 0, 0, <0.125, 0.625, 0.0>, 0.1, <0.0, 0.0, 0.0>, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>,
                              17, -1, "5748decc-f629-461c-9a36-a35a221fe21f", <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0]);
        llRemoveInventory(llGetScriptName()); // Done its job so self deletes.
    }
}

 

 

CamHUD Script

 

Drop this script into the prim you just created. Wear the object as a HUD. If you do not see two distinct buttons separated by a black line, it is probably back to front or something.

 

// V1 //
 
integer perms;
 
integer track;
 
integer on;
 
vector red = <1.0,0.0,0.0>;
 
vector green = <0.0,1.0,0.0>;
 
SetCameraParams(integer o, integer t)
{
    list focus = [];
    llClearCameraParams();
    if(t)
    focus = [CAMERA_FOCUS, llGetPos()];
    else
    focus = [CAMERA_FOCUS_LOCKED, TRUE];
    llSetCameraParams([CAMERA_ACTIVE, o, CAMERA_POSITION_LOCKED, TRUE] + focus);
}
 
default
{
    on_rez(integer param)
    {
        llResetScript();
    }
    state_entry()
    {
        if(llGetAttached())
        llRequestPermissions(llGetOwner(), PERMISSION_CONTROL_CAMERA);
    }
    run_time_permissions(integer perm)
    {
        if(perm & PERMISSION_CONTROL_CAMERA)
        {
            perms = TRUE;
            llSetText("   Track | Power", <1.0,1.0,1.0>, 1.0);
            llSetLinkPrimitiveParamsFast(-1, [PRIM_COLOR, -1, <0.0,0.0,0.0>, 1.0,
                                              PRIM_COLOR, 6, red, 1.0,
                                              PRIM_COLOR, 7, red, 1.0]);
        }
    }
    touch_start(integer nd)
    {
        if(perms)
        {
            integer face;
            vector color;
            if((face = llDetectedTouchFace(0)) == 6)
            {
                SetCameraParams((on = (!on)), track);
                if(on)
                color = green;
                else
                color = red;
            }
            else if(face == 7)
            {
                SetCameraParams(on, (track = (!track)));
                if(track)
                color = green;
                else
                color = red;
            }
            llSetLinkPrimitiveParamsFast(-1, [PRIM_COLOR, face, color, 1.0]);
        }
    }
}