Difference between revisions of "User:Dora Gustafson/captureCameraView"

From Second Life Wiki
Jump to: navigation, search
(llSetLinkCamera)
 
(Camera View Capture)
Line 1: Line 1:
 
<div id="box">
 
<div id="box">
 
==llSetLinkCamera() Example==
 
==llSetLinkCamera() Example==
=====Camera View Capture=====
+
=====Capture Camera View=====
 
<lsl>
 
<lsl>
 
// camera capture/release test, script by Dora Gustafson, Studio Dora 2012
 
// camera capture/release test, script by Dora Gustafson, Studio Dora 2012

Revision as of 04:29, 5 October 2012

llSetLinkCamera() Example

Capture Camera View

<lsl> // camera capture/release test, script by Dora Gustafson, Studio Dora 2012 // v1.1 // save script in prim // sit on the prim // move camera // touch the prim to capture camera view or release capture

integer gag = FALSE;

default {

   state_entry()
   {
       llSitTarget( < 0.25, 0.0, 0.6 >, ZERO_ROTATION);
       llSetClickAction(CLICK_ACTION_SIT);
       llOwnerSay("To verify: stand up, press Esc, sit down and try to move the camera by the arrow keys");
   }
   touch_end(integer num)
   {
       gag = !gag;
       if (gag) llRequestPermissions( llGetOwner(), PERMISSION_TRACK_CAMERA);
       else
       {
           llSetLinkCamera( LINK_THIS, ZERO_VECTOR, ZERO_VECTOR);
           llOwnerSay("Capture released");
       }
   }
   run_time_permissions(integer perm)
   {
       if( perm & PERMISSION_TRACK_CAMERA)
       {
           rotation cam_rot=llGetCameraRot()/llGetRot(); // relative camera rotation
           vector cam_pos=(llGetCameraPos()-llGetPos())/llGetRot(); // relative camera position
           llSetLinkCamera( LINK_THIS, cam_pos, cam_pos + llRot2Fwd(cam_rot));
           llOwnerSay("Camera view captured");
       }
   }

}

</lsl>