Jump to content

Uli Sperber

Resident
  • Posts

    2
  • Joined

  • Last visited

Reputation

0 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Ok I fixed it, here is the full script as simple on/off-Button-HUD: //based on Linden Labs //Dan Linden integer on = FALSE; key agent = "xxxxxxxxxxxxxxxxxxxxx"; // avatar key // colors see http://wiki.secondlife.com/wiki/Category:LSL_Color vector red = <1.000, 0.255, 0.212>; vector blue = <0.000, 0.455, 0.851>; overhead_cam() { llOwnerSay("overhead_cam_new"); // say function name for debugging vector xyz = llGetPos(); float xx = 234.0; float yy = 36.0; float zz = 30.5; float zz2 = 8.0; if (xyz.x < xx) { xyz.x = xx - xyz.x ; // x + diff = newPos } else { xyz.x = (xyz.x - xx) * -1; // x + (minusDiff) = newPos } if (xyz.y < yy) { xyz.y = yy - xyz.y ; // y + diff = newPos } else { xyz.y = (xyz.y - yy) * -1; // y + (minusDiff) = newPos } if (xyz.z < zz) { xyz.z = zz - xyz.z ; // z + diff = newPos } else { xyz.z = (xyz.z - zz) * -1; // z + (minusDiff) = newPos } vector xyz2 = xyz; xyz2.z = xyz.z - zz2; xyz = llGetPos() + xyz ; xyz2 = llGetPos() + xyz2 ; rotation camRot = llGetCameraRot(); llSetCameraParams([ CAMERA_ACTIVE, 1, // 1 is active, 0 is inactive CAMERA_BEHINDNESS_ANGLE, 20.0, // (0 to 180) degrees CAMERA_BEHINDNESS_LAG, 0.0, // (0 to 3) seconds CAMERA_DISTANCE, 3.0, // ( 0.5 to 10) meters //CAMERA_FOCUS, <0,0,5>, // region relative position CAMERA_FOCUS, xyz2 + <0.0, 0.0, -180.0> * camRot, // region relative position CAMERA_FOCUS_LAG, 0.05 , // (0 to 3) seconds CAMERA_FOCUS_LOCKED, TRUE, // (TRUE or FALSE) CAMERA_FOCUS_THRESHOLD, 0.0, // (0 to 4) meters // CAMERA_PITCH, 80.0, // (-45 to 80) degrees CAMERA_POSITION, xyz , // region relative position CAMERA_POSITION_LAG, 0.0, // (0 to 3) seconds CAMERA_POSITION_LOCKED, TRUE, // (TRUE or FALSE) CAMERA_POSITION_THRESHOLD, 4.0 // (0 to 4) meters // CAMERA_FOCUS_OFFSET, <0,0,0> // <-10,-10,-10> to <10,10,10> meters ]); } default { state_entry() { llRequestPermissions(agent, PERMISSION_CONTROL_CAMERA | PERMISSION_TRACK_CAMERA ); llSetCameraParams([CAMERA_ACTIVE, 1]); // 1 is active, 0 is inactive integer perm = llGetPermissions(); if ((perm & PERMISSION_CONTROL_CAMERA) == PERMISSION_CONTROL_CAMERA) { llSetCameraParams([CAMERA_ACTIVE, 1]); // 1 is active, 0 is inactive llOwnerSay("Camera permissions have been taken"); llSetColor(blue, ALL_SIDES); llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, blue, 1, 10, 2]); } } touch_start(integer total_number) { if (on == FALSE) // overhead an { llOwnerSay("take_camera_control, press ESC after first time touched to change view to object"); llRequestPermissions(agent, PERMISSION_CONTROL_CAMERA | PERMISSION_TRACK_CAMERA); llSetCameraParams([CAMERA_ACTIVE, 1]); // 1 is active, 0 is inactive overhead_cam(); llSetColor(red, ALL_SIDES); llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, red, 1, 10, 2]); on = TRUE; } else if (on == TRUE) // overhead aus { llOwnerSay("release_camera_control"); // say function name for debugging llSetCameraParams([CAMERA_ACTIVE, 0]); // 1 is active, 0 is inactive llReleaseCamera(agent); llSetColor(blue, ALL_SIDES); llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, blue, 1, 10, 2]); on = FALSE; } } } only last thing is, the new view differs a bit depending on position, avatar stands when pressed button, but this is ok for first. And pressing ESC when first time used to change to new view is still needed.
  2. i have an additional question: I want to set Camera to a special region based Camara Co-ordinates and then rotation turn to ground (use with a hud, not connected to a prim). I tried it with this one: overhead_cam() { llOwnerSay("overhead_cam_new"); // say function name for debugging default_cam(); vector xyz = llGetPos(); // change to postition <234.5, 34.0, 26> llOwnerSay("positionx " + (string) xyz.x); // old positions llOwnerSay("positiony " + (string) xyz.y); llOwnerSay("positionz " + (string) xyz.z); if (xyz.x < 234.5) { xyz.x = 234.5 - xyz.x ; // x + diff = newPos } else { xyz.x = (xyz.x - 234.5) * -1; // x + (minusDiff) = newPos } if (xyz.y < 34.0) { xyz.y = 34.0 - xyz.y ; // y + diff = newPos } else { xyz.y = (xyz.y - 34.0) * -1; // y + (minusDiff) = newPos } if (xyz.z < 26) { xyz.z = 26 - xyz.z ; // z + diff = newPos } else { xyz.z = (xyz.z - 26) * -1; // z + (minusDiff) = newPos } xyz = llGetPos() + xyz ; llOwnerSay("positionx " + (string) xyz.x); // new positions llOwnerSay("positiony " + (string) xyz.y); llOwnerSay("positionz " + (string) xyz.z); llSetCameraParams([ CAMERA_ACTIVE, 1, // 1 is active, 0 is inactive CAMERA_BEHINDNESS_ANGLE, 180.0, // (0 to 180) degrees CAMERA_BEHINDNESS_LAG, 0.5, // (0 to 3) seconds CAMERA_DISTANCE, 3.0, // ( 0.5 to 10) meters //CAMERA_FOCUS, <0,0,5>, // region relative position CAMERA_FOCUS, xyz, // region relative position CAMERA_FOCUS_LAG, 0.05 , // (0 to 3) seconds CAMERA_FOCUS_LOCKED, TRUE, // (TRUE or FALSE) CAMERA_FOCUS_THRESHOLD, 0.0, // (0 to 4) meters CAMERA_PITCH, 80.0, // (-45 to 80) degrees CAMERA_POSITION, xyz, // region relative position CAMERA_POSITION_LAG, 0.0, // (0 to 3) seconds CAMERA_POSITION_LOCKED, TRUE, // (TRUE or FALSE) CAMERA_POSITION_THRESHOLD, 0.0, // (0 to 4) meters CAMERA_FOCUS_OFFSET, <0,0,0> // <-10,-10,-10> to <10,10,10> meters ]); } It sets the cam to the position i wish, but has following problems: -1- screen is black after use button -2- Rotation is still turned to avatar, not to ground -3- camera_focus and _position are same here, but i could not find other settings, that worked... What can i do better?
×
×
  • Create New...