Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Simple Camera Attachment

Frost White
Second Life Resident
Join date: 3 Nov 2004
Posts: 44
03-17-2006 15:04
Before people start making you pay a lot of linden for a simple script like this, i decided to hand out a free open source one. I used the available script from the LSL wiki, made mods so it simulates regular camera movement but with a little swing to it. This is something that shield users will love since you no longer have to worry about your inner shield zooming your camera up to your neck. I post this here in hopes it wil be usefull, and hopes that any bugs in it can be fixed and re posted here to correct it. The more perfected it is the better it is for you to use. pass it along and enjoy.

-Frostfox

CODE

key id;
default
{
attach(key id)
{
if (id == NULL_KEY)
{
if (llGetPermissions() & PERMISSION_CONTROL_CAMERA)llClearCameraParams();
}
else
{
llRequestPermissions(id, PERMISSION_CONTROL_CAMERA);
llInstantMessage(id,"Online! Camera will be facing down on you until you start walking.");
}
}
run_time_permissions(integer perm)
{
if (perm & PERMISSION_CONTROL_CAMERA)
{
llSetCameraParams([

CAMERA_ACTIVE, 1, // 1 is active, 0 is inactive
CAMERA_DISTANCE, 5.0, // ( 0.5 to 10) meters
CAMERA_PITCH, 10.0, // (-45 to 80) degrees

CAMERA_BEHINDNESS_ANGLE, 0.0, // (0 to 180) degrees
CAMERA_BEHINDNESS_LAG, 0.1, // (0 to 3) seconds

CAMERA_FOCUS_OFFSET, <0.0,0.0,1.5>, // <-10,-10,-10> to <10,10,10> meters

CAMERA_FOCUS, llGetPos(), // region-relative position
CAMERA_FOCUS_LAG, 0.1, // (0 to 3) seconds
CAMERA_FOCUS_THRESHOLD, 0.1, // (0 to 4) meters
CAMERA_FOCUS_LOCKED, FALSE, // (TRUE or FALSE)

CAMERA_POSITION, llGetPos(), // region-relative position
CAMERA_POSITION_LAG, 0.5, // (0 to 3) seconds
CAMERA_POSITION_THRESHOLD, 0.5, // (0 to 4) meters
CAMERA_POSITION_LOCKED, FALSE // (TRUE or FALSE)

]);
}
}
}
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Discussion Thread
03-20-2006 08:34
/54/a1/94849/1.html
_____________________
i've got nothing. ;)
Robin Peel
Registered User
Join date: 8 Feb 2005
Posts: 163
03-20-2006 09:51
Thank you so much for this script.
Yiffy Yaffle
Purple SpiritWolf Mystic
Join date: 22 Oct 2004
Posts: 2,802
03-22-2006 17:51
Hewo Frost. I've been working on this too. Its best you remove these 2 lines.
CAMERA_FOCUS, llGetPos(), // region-relative position
CAMERA_POSITION, llGetPos(), // region-relative position

Your setup would make the camera start off at a position and zoom to your avatar sometimes forcing it to view into your scalp. By removing these lines that should fix it.

Here is a improved version.

CODE

integer trigger;
default
{
state_entry()
{
llRequestPermissions(llGetOwner(), PERMISSION_CONTROL_CAMERA);llOwnerSay("on");
trigger = TRUE;
}
on_rez(integer start)
{
llResetScript();
}
touch_start(integer total_number)
{
if(!trigger){llRequestPermissions(llGetOwner(), PERMISSION_CONTROL_CAMERA);llOwnerSay("on");trigger = TRUE;}
else if(trigger){llClearCameraParams();llOwnerSay("off");trigger = FALSE;}
}
attach(key id)
{
if (id == NULL_KEY)
{
if (llGetPermissions() & PERMISSION_CONTROL_CAMERA)llClearCameraParams();
}
else
{
llRequestPermissions(id, PERMISSION_CONTROL_CAMERA);
}
}
run_time_permissions(integer perm)
{
if (perm & PERMISSION_CONTROL_CAMERA)
{
llSetCameraParams([
CAMERA_ACTIVE, 1, // 1 is active, 0 is inactive
CAMERA_DISTANCE, 3.0, // ( 0.5 to 10) meters
CAMERA_PITCH, 10.0, // (-45 to 80) degrees
CAMERA_BEHINDNESS_ANGLE, 0.0, // (0 to 180) degrees
CAMERA_BEHINDNESS_LAG, 0.0, // (0 to 3) seconds
CAMERA_FOCUS_OFFSET, <0.0,0.0,1.5>, // <-10,-10,-10> to <10,10,10> meters
CAMERA_FOCUS_LAG, 0.0, // (0 to 3) seconds
CAMERA_FOCUS_THRESHOLD, 0.0, // (0 to 4) meters
CAMERA_FOCUS_LOCKED, FALSE, // (TRUE or FALSE)
CAMERA_POSITION_LAG, 0.0, // (0 to 3) seconds
CAMERA_POSITION_THRESHOLD, 0.0, // (0 to 4) meters
CAMERA_POSITION_LOCKED, FALSE // (TRUE or FALSE)
]);
}
}
}
_____________________
Bizarre Berry
Registered User
Join date: 9 Jun 2006
Posts: 30
Remote pictures?
06-12-2006 15:07
Does this 'camera' actually allow you to take pictures or snapshots? If so, is is possible to have a remote camera to take pictures of locations where you're not presently located? Like, keeping an eye on your shop or something?

Thanks!
Eadoin Welles
Registered User
Join date: 5 Jan 2007
Posts: 149
02-05-2007 01:08
What this script exactly does?