Open sl-service-account opened 3 years ago
Rohacan Hirons commented at 2020-12-06T15:12:37Z, updated at 2020-12-06T17:48:08Z
Here is the sample script
dettach to stop
// code placeholder
integer Step;
default
{
on_rez(integer a) {
if(llGetAttached()) llRequestPermissions(llGetOwner(), PERMISSION_CONTROL_CAMERA);
}
state_entry() {
if(llGetAttached()) llRequestPermissions(llGetOwner(), PERMISSION_CONTROL_CAMERA);
}
attach(key id) {
if(id) llRequestPermissions(llGetOwner(), PERMISSION_CONTROL_CAMERA);
}
touch_start(integer a) {
if(++Step > 3) Step = 0;
vector camPos = llList2Vector([<140, 135, 40>, <27, 30, 40>, <230, 230, 40>, <230, 30, 40>], Step);
vector camFocus = llList2Vector([<128, 128, 35>, <30, 35, 35>, <256, 256, 35>, <256, 0, 35>], Step);
llSetCameraParams([CAMERA_POSITION, camPos, CAMERA_FOCUS, camFocus]);
}
run_time_permissions(integer p) {
llSetCameraParams([
CAMERA_ACTIVE, TRUE,
CAMERA_POSITION_LOCKED, TRUE,
CAMERA_POSITION_LAG, 2.5,
CAMERA_FOCUS_LOCKED, TRUE,
CAMERA_FOCUS_LAG, 2.5,
CAMERA_POSITION, <140, 135, 40>,
CAMERA_FOCUS, <128, 128, 35>,
// We can't use this parameters, they don't exist server side
//FOLLOWCAM_LAG_POSITION_LOCKED , TRUE,
//FOLLOWCAM_LAG_FOCUS_LOCKED , TRUE,
// We use instead CAMERA_BEHINDNESS_LAG = 0.295
// this special value set FOLLOWCAM_LAG_POSITION_LOCKED and FOLLOWCAM_LAG_FOCUS_LOCKED to TRUE
CAMERA_BEHINDNESS_LAG, 0.295
]);
}
}
Rohacan Hirons commented at 2021-01-23T13:28:31Z
Hi, as suggested in another feature request I made, I filled the contributor agreement, then fill FREE TO USE THIS CODE too, thanks.
How would you like the feature to work?
When a script takes camera controls and set the camera to be locked on a position and/or locked focus, we should be able to add a lag to the camera movements. To do this we should set two new parameters value: FOLLOWCAM_LAG_POSITION_LOCKED FOLLOWCAM_LAG_FOCUS_LOCKED both are boleans, default value FALSE
I had compiled my own viewer in april 2019, sent suggestion and updated files to opensource-dev@lists.secondlife.com but never received any answer. I tryed to suggest this on Firestorm JIRA too with no success even with sending a patch file. Here the 4 files I have updated, I join:
indra/newview/llfollowcam.cpp indra/newview/llfollowcam.h indra/newview/llviewermessage.cpp indra/llmessage/llfollowcamparams.h
Everything is set up to receive and use these two parameters, except server side, I cannot use them in a script, that's why at this time I used FOLLOWCAM_BEHINDNESS_LAG value to set these two new parameters to true or false (true when FOLLOWCAM_BEHINDNESS_LAG == 0.295f)
FOLLOWCAM_BEHINDNESS_LAG is named CAMERA_BEHINDNESS_LAG in the LSL function
Of course you can define other names in the LSL function for FOLLOWCAM_LAG_POSITION_LOCKED and FOLLOWCAM_LAG_FOCUS_LOCKED
And, sure, you can use my work as you wish, I give LLab fullperms on it ... joking. Do whatever you want with it, no need to ask me any permission, no need to add my name anywhere, just add this feature please. Thanks
Why is this feature important to you? How would it benefit the community?
This allows coders to make a script able to switch camera position smoothly, and more important, a script able to make the camera follow smoothly an object or a path.
Update: I redo all changes on new files (from LLab viewer source pages january 5th 2021) and replaced old ones here.
Remember: If you add server side variables, you can remove behindnesslag value check from llfollowcam.cpp (in function setBehindnessLag) because scripts will no longer need to use this workaround:
Attachments
Original Jira Fields
| Field | Value | | ------------- | ------------- | | Issue | BUG-229796 | | Summary | Add lag parameters for locked pos and focus in function llSetCameraParams() | | Type | New Feature Request | | Priority | Unset | | Status | Accepted | | Resolution | Accepted | | Reporter | Rohacan Hirons (rohacan.hirons) | | Created at | 2020-12-06T13:59:11Z | | Updated at | 2021-01-23T13:28:31Z | ``` { 'Build Id': 'unset', 'Business Unit': ['Platform'], 'How would you like the feature to work?': "When a script takes camera controls and set the camera to be locked on a position and/or locked focus, we should be able to add a lag to the camera movements. To do this we should set two new parameters value:\r\nFOLLOWCAM_LAG_POSITION_LOCKED \r\nFOLLOWCAM_LAG_FOCUS_LOCKED\r\nboth are boleans, default value FALSE\r\n\r\nI had compiled my own viewer in april 2019, sent suggestion and updated files to opensource-dev@lists.secondlife.com but never received any answer. I tryed to suggest this on Firestorm JIRA too with no success even with sending a patch file. Here the 4 files I have updated, I join:\r\n\r\nindra/newview/llfollowcam.cpp\r\nindra/newview/llfollowcam.h\r\nindra/newview/llviewermessage.cpp\r\nindra/llmessage/llfollowcamparams.h \r\n\r\nEverything is set up to receive and use these two parameters, except server side, I cannot use them in a script, that's why at this time I used FOLLOWCAM_BEHINDNESS_LAG value to set these two new parameters to true or false (true when FOLLOWCAM_BEHINDNESS_LAG == 0.295f)\r\n\r\nAs said, I made this in april 2019. Maybe these 4 files have be updated since and I don't want to lose time again on my side thinking you may not use my work, then, for nothing. I don't think these files changed, or probably not a lot, you should be able to easily rewrite my changes on new files.", 'Original Reporter': 'Rohacan Hirons (rohacan.hirons)', 'ReOpened Count': 0.0, 'Severity': 'Unset', 'Target Viewer Version': 'viewer-development', 'Why is this feature important to you? How would it benefit the community?': 'This allows coders to make a script able to switch camera position smoothly, and more important, a script able to make the camera follow smoothly an object!', } ```