User:Ezian Ecksol: Difference between revisions
Jump to navigation
Jump to search
Ezian Ecksol (talk | contribs) No edit summary |
Ezian Ecksol (talk | contribs) No edit summary |
||
| Line 1: | Line 1: | ||
'''Cam Lock/Follow''' | '''Cam Lock/Follow''' | ||
<lsl> | <lsl> | ||
// (c) Ezian Ecksol | // Camstyle, (c) Ezian Ecksol, feel free to copy, steal, modify | ||
// Put script into prim, attach it. | // Put script into prim, attach it. | ||
// | // usage: position your camera where you like. | ||
// | // enter in chan: | ||
// | // /1 camstyle follow <-- camera is fixed, but follows your av | ||
// | // /1 camstyle lock <-- camera is completly locked | ||
// /1 camstyle <-- releases cam again | |||
integer chan = 1; | integer chan = 1; | ||
Revision as of 05:23, 20 September 2008
Cam Lock/Follow <lsl> // Camstyle, (c) Ezian Ecksol, feel free to copy, steal, modify
// Put script into prim, attach it. // usage: position your camera where you like. // enter in chan: // /1 camstyle follow <-- camera is fixed, but follows your av // /1 camstyle lock <-- camera is completly locked // /1 camstyle <-- releases cam again
integer chan = 1;
key owner; list keywords = ["lock", "follow"];
cam_style(integer cs) {
llRequestPermissions(owner, PERMISSION_CONTROL_CAMERA | PERMISSION_TRACK_CAMERA);
llClearCameraParams();
if (!cs)
return;
vector cpos = llGetCameraPos();
list params = [CAMERA_ACTIVE, TRUE, CAMERA_POSITION_LOCKED, TRUE, CAMERA_POSITION_THRESHOLD, 0.5,
CAMERA_FOCUS_THRESHOLD, 0.5, CAMERA_POSITION, cpos];
if (cs == 1)
params += [
CAMERA_DISTANCE, .5, // ( 0.5 to 10) meters
CAMERA_BEHINDNESS_LAG, 0.1, // (0 to 3) seconds
CAMERA_PITCH, 10.0, // (-45 to 80) degrees
CAMERA_FOCUS, cpos + llRot2Fwd(llGetCameraRot()), // region-relative position
CAMERA_FOCUS_LAG, 0.1, // (0 to 3) seconds
CAMERA_FOCUS_LOCKED, TRUE, // (TRUE or FALSE)
CAMERA_POSITION_LAG, 1.0 // (0 to 3) seconds
];
else if (cs == 2)
params += [
CAMERA_FOCUS_LAG, 0.0, // (0 to 3) seconds
CAMERA_BEHINDNESS_LAG, 0.5 // (0 to 3) seconds
];
llSetCameraParams(params);
}
default {
state_entry() {
owner = llGetOwner();
llListen(chan, "", owner, "");
}
listen(integer channel, string name, key id, string msg) {
msg = llToLower(msg);
list m = llParseString2List(msg, [" "], []);
if (llList2String(m, 0) == "camstyle")
cam_style(llListFindList(keywords, [llList2String(m, 1)]) + 1);
}
changed(integer c) {
if (c & CHANGED_OWNER)
llResetScript();
}
} </lsl>