ItHadToComeToThis Posted October 4, 2023 Share Posted October 4, 2023 So, I just can not seem to get camera params and positions to work correctly in LSL, idk why, so raising this to the forums. I was thinking about side on fighting games like Tekken, Soul Calibre etc and I wanted to try and re create the side view camera. How do I get my camera to face me perfectly from the left side, mid body height, at a distance of 10m away, positioned in the central point between myself and another avatar? Basically so the two avatars are central on the screen, from the left side? Link to comment Share on other sites More sharing options...
Quistess Alpha Posted October 4, 2023 Share Posted October 4, 2023 (edited) SL camera controls are borked because there's no way to turn off the camera's default behaviors without destroying its ability to smoothly interpolate between positions. that said: vector gPosTarget = <38,166,2016>; default { state_entry() { llRequestPermissions(llGetOwner(),PERMISSION_CONTROL_CAMERA); } run_time_permissions(integer perms) { if(perms) llSetTimerEvent(0.022); } timer() { vector posOwner = llList2Vector(llGetObjectDetails(llGetOwner(),[OBJECT_POS]),0); vector posBetween = 0.5*(gPosTarget+posOwner); // exageratedly far out: //vector posLeft = posBetween+ 10*llVecNorm((gPosTarget-posOwner)*<0,0,0.71,0.71>); // different zooming: //vector posLeft = (0.75*posOwner)+(0.25*gPosTarget) + 0.9*((gPosTarget-posOwner)*<0,0,0.71,0.71>); // more like mortal combat: vector posLeft = posBetween + 0.65*((gPosTarget-posOwner)*<0,0,0.71,0.71>); //posLeft.z = posOwner.z+2.0; // higher camera looks better further away, posLeft.z = posOwner.z; llSetCameraParams( [ CAMERA_ACTIVE, TRUE, CAMERA_FOCUS_LOCKED, TRUE, CAMERA_POSITION_LOCKED, TRUE, CAMERA_FOCUS, posBetween, CAMERA_POSITION, posLeft ]); } } Roughly works. Edited October 4, 2023 by Quistess Alpha parameters are too fun to play with >.< 1 Link to comment Share on other sites More sharing options...
ItHadToComeToThis Posted October 4, 2023 Author Share Posted October 4, 2023 38 minutes ago, Quistess Alpha said: SL camera controls are borked because there's no way to turn off the camera's default behaviors without destroying its ability to smoothly interpolate between positions. that said: vector gPosTarget = <38,166,2016>; default { state_entry() { llRequestPermissions(llGetOwner(),PERMISSION_CONTROL_CAMERA); } run_time_permissions(integer perms) { if(perms) llSetTimerEvent(0.022); } timer() { vector posOwner = llList2Vector(llGetObjectDetails(llGetOwner(),[OBJECT_POS]),0); vector posBetween = 0.5*(gPosTarget+posOwner); // exageratedly far out: //vector posLeft = posBetween+ 10*llVecNorm((gPosTarget-posOwner)*<0,0,0.71,0.71>); // different zooming: //vector posLeft = (0.75*posOwner)+(0.25*gPosTarget) + 0.9*((gPosTarget-posOwner)*<0,0,0.71,0.71>); // more like mortal combat: vector posLeft = posBetween + 0.65*((gPosTarget-posOwner)*<0,0,0.71,0.71>); //posLeft.z = posOwner.z+2.0; // higher camera looks better further away, posLeft.z = posOwner.z; llSetCameraParams( [ CAMERA_ACTIVE, TRUE, CAMERA_FOCUS_LOCKED, TRUE, CAMERA_POSITION_LOCKED, TRUE, CAMERA_FOCUS, posBetween, CAMERA_POSITION, posLeft ]); } } Roughly works. Thanks! Every time I have tried to get camera params to work its never worked properly for me. I appreciate you showing me this. Link to comment Share on other sites More sharing options...
Quistess Alpha Posted October 4, 2023 Share Posted October 4, 2023 7 hours ago, ItHadToComeToThis said: Every time I have tried to get camera params to work its never worked properly for me. I appreciate you showing me this. I don't think it says as much on the wiki, but CAMERA_POSITION and CAMERA_FOCUS are the most generally useful for doing anything that isn't specifically intended by the built-in camera model, but, they're quickly overridden by said model unless the *_LOCKED parameters are set to TRUE. I don't like using fast timers, but you need this to go as fast as possible for it to not feel bad. Also, given its server-side nature, it might feel weird for people with a laggy connection. Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now