Tattooshop Posted June 11, 2021 Share Posted June 11, 2021 Hello! How to make the rotation effect of the lighthouse beam if it is part of a linkset? If the beam protrudes strongly forward, naturally the center is displaced. And the rotation will take place in the middle of the beam ... ( Except adding an invisible triangle mesh at the opposite end of the beam. ) Link to comment Share on other sites More sharing options...
Qie Niangao Posted June 11, 2021 Share Posted June 11, 2021 Yeah, if it must be a mesh, it's least laggy to add that tri at the opposite end to get the center to be the axis of rotation. If it can be a simple tapered cylinder, just slice it so the center is where you want it. Either way, you'll use llTargetOmega to avoid the more complex (and much laggier) constant adjustment of rotation about an axis offset from the link's center. (That's certainly possible, but not something to do constantly if you can avoid it, as you can here.) 2 1 Link to comment Share on other sites More sharing options...
Quistess Alpha Posted June 11, 2021 Share Posted June 11, 2021 I agree with Qie that llTargetOmega is much better if you can use it, but setting a links rotation and position based on a non-root center of rotation is occasionally useful for other things (not a constantly rotating lighthouse light) and not /that/ difficult: // Global Variables: vector Center_of_Rotation; // in local coords, or for global just modify llSLPPF a little. vector Offset = <position of linked prim when at zero rotation>-Center_of_Rotation; rotation g_rot; // set this to different rotatitons, or multiply it a marginal ammount on a timer. //... //on a timer or whatever: llSLPPF(link,[PRIM_POS_LOCAL,Center_of_rotation+Offset*g_rot,PRIM_ROT_LOCAL,g_rot]); 1 1 Link to comment Share on other sites More sharing options...
Tattooshop Posted June 11, 2021 Author Share Posted June 11, 2021 4 hours ago, Qie Niangao said: Yeah, if it must be a mesh, it's least laggy to add that tri at the opposite end to get the center to be the axis of rotation. If it can be a simple tapered cylinder, just slice it so the center is where you want it. Either way, you'll use llTargetOmega to avoid the more complex (and much laggier) constant adjustment of rotation about an axis offset from the link's center. (That's certainly possible, but not something to do constantly if you can avoid it, as you can here.) 2 hours ago, Quistessa said: I agree with Qie that llTargetOmega is much better if you can use it, but setting a links rotation and position based on a non-root center of rotation is occasionally useful for other things (not a constantly rotating lighthouse light) and not /that/ difficult: // Global Variables: vector Center_of_Rotation; // in local coords, or for global just modify llSLPPF a little. vector Offset = <position of linked prim when at zero rotation>-Center_of_Rotation; rotation g_rot; // set this to different rotatitons, or multiply it a marginal ammount on a timer. //... //on a timer or whatever: llSLPPF(link,[PRIM_POS_LOCAL,Center_of_rotation+Offset*g_rot,PRIM_ROT_LOCAL,g_rot]); Thank you so much! There are several movements but stops quickly. What did I do wrong? vector rotate = < 0, 0, 10 > ; rotation rot; default { state_entry() { llSetTimerEvent(1); } timer() { // Global Variables: vector Center_of_Rotation = < 73.66853, 145.58430, 3017.25000 > ; // in local coords, or for global just modify llSLPPF a little. vector Offset = < -1.24544, -0.06297, 0.00000 > -Center_of_Rotation; rotation g_rot; // set this to different rotatitons, or multiply it a marginal ammount on a timer. rotate *= DEG_TO_RAD; g_rot = llEuler2Rot(rotate); //... //on a timer or whatever: llSetLinkPrimitiveParamsFast(2, [PRIM_POS_LOCAL, Center_of_Rotation + Offset * g_rot, PRIM_ROT_LOCAL, g_rot]); } } Link to comment Share on other sites More sharing options...
Quistess Alpha Posted June 11, 2021 Share Posted June 11, 2021 27 minutes ago, Tattooshop said: What did I do wrong? 🙊 1 Link to comment Share on other sites More sharing options...
Profaitchikenz Haiku Posted June 12, 2021 Share Posted June 12, 2021 7 hours ago, Tattooshop said: There are several movements but stops quickly. What did I do wrong? You put the global variables in the timer section so they are constantly being re-initialised once a second. The timer section needs to update the rotation and then adjust the beam by calling setPrimitiveParams, but I don't see an option in the code to repeatedly increase the rotation amount 1 Link to comment Share on other sites More sharing options...
Tattooshop Posted June 12, 2021 Author Share Posted June 12, 2021 9 hours ago, Quistessa said: 🙊 2 hours ago, Profaitchikenz Haiku said: You put the global variables in the timer section so they are constantly being re-initialised once a second. The timer section needs to update the rotation and then adjust the beam by calling setPrimitiveParams, but I don't see an option in the code to repeatedly increase the rotation amount There was a feeling that I did something stupid, thanks! Link to comment Share on other sites More sharing options...
VirtualKitten Posted June 12, 2021 Share Posted June 12, 2021 Easiest way with mesh beam is to place a vertex node exactly at a point from the beam end equidistant to the beam in this way the beam willeo have full size and you can rotate it wil usual methods very easily without lag 1 Link to comment Share on other sites More sharing options...
Tattooshop Posted June 12, 2021 Author Share Posted June 12, 2021 4 hours ago, VirtualKitten said: Easiest way with mesh beam is to place a vertex node exactly at a point from the beam end equidistant to the beam in this way the beam willeo have full size and you can rotate it wil usual methods very easily without lag Yes, thanks, most likely I will have to do this, or use a cylinder sliced off in the middle, if it's not a mesh but prim. Link to comment Share on other sites More sharing options...
Tattooshop Posted June 12, 2021 Author Share Posted June 12, 2021 I moved global variables to the beginning of the script. In order to educate myself, I would still like to know what is wrong here. vector rotate = < 0, 0, 10 > ; // Global Variables: vector Center_of_Rotation = < 73.66853, 145.58430, 3017.25000 > ; // in local coords, or for global just modify llSLPPF a little. vector Offset = < -1.24544, -0.06297, 0.00000 > -Center_of_Rotation; rotation g_rot; // set this to different rotatitons, or multiply it a marginal ammount on a timer. rotate *= DEG_TO_RAD; g_rot = llEuler2Rot(rotate); default { state_entry() { llSetTimerEvent(1); } timer() { //... //on a timer or whatever: llSetLinkPrimitiveParamsFast(2, [PRIM_POS_LOCAL, Center_of_Rotation + Offset * g_rot, PRIM_ROT_LOCAL, g_rot]); } } Link to comment Share on other sites More sharing options...
VirtualKitten Posted June 12, 2021 Share Posted June 12, 2021 oh its not going to be great a simple mesh cone will do it with and extra vector im me in world i will send you one loo look at 1 Link to comment Share on other sites More sharing options...
Quistess Alpha Posted June 12, 2021 Share Posted June 12, 2021 Fiiiine. . . // Global Variables: vector Center_of_Rotation = < 0.0, 2.0, 5.0 > ; // in local coords, or for global just modify llSLPPF a little. vector Offset = < 2.5, 0.0, 0.0 >; rotation Current_Rotation; // the rotation accumulator for the rotating linked prim. rotation Delta_Rotation; // = llAxisAngle2Rot(<0,0,1>,5*DEG_TO_RAD); rotation Link_Zero_Rotation; // = llEuler2Rot(<0,90,0>*DEG_TO_RAD); // the rotation of the linked prim when in its default position and the root is at 0 rotation. // you can't calculate in the preamble, so move that to state_entry. default { state_entry() { Delta_Rotation = llAxisAngle2Rot(<0,0,1>,5*DEG_TO_RAD); Link_Zero_Rotation = llRotBetween(<0,0,1>,<1,0,0>); llSetTimerEvent(0.2); } timer() { Current_Rotation*= Delta_Rotation; llSetLinkPrimitiveParamsFast(2, [ PRIM_POS_LOCAL, Center_of_Rotation + Offset * Current_Rotation, PRIM_ROT_LOCAL, Link_Zero_Rotation*Current_Rotation ]); } } 1 Link to comment Share on other sites More sharing options...
Tattooshop Posted June 12, 2021 Author Share Posted June 12, 2021 6 hours ago, Quistessa said: Fiiiine. . . // Global Variables: vector Center_of_Rotation = < 0.0, 2.0, 5.0 > ; // in local coords, or for global just modify llSLPPF a little. vector Offset = < 2.5, 0.0, 0.0 >; rotation Current_Rotation; // the rotation accumulator for the rotating linked prim. rotation Delta_Rotation; // = llAxisAngle2Rot(<0,0,1>,5*DEG_TO_RAD); rotation Link_Zero_Rotation; // = llEuler2Rot(<0,90,0>*DEG_TO_RAD); // the rotation of the linked prim when in its default position and the root is at 0 rotation. // you can't calculate in the preamble, so move that to state_entry. default { state_entry() { Delta_Rotation = llAxisAngle2Rot(<0,0,1>,5*DEG_TO_RAD); Link_Zero_Rotation = llRotBetween(<0,0,1>,<1,0,0>); llSetTimerEvent(0.2); } timer() { Current_Rotation*= Delta_Rotation; llSetLinkPrimitiveParamsFast(2, [ PRIM_POS_LOCAL, Center_of_Rotation + Offset * Current_Rotation, PRIM_ROT_LOCAL, Link_Zero_Rotation*Current_Rotation ]); } } Thank you so much! Link to comment Share on other sites More sharing options...
Tattooshop Posted June 13, 2021 Author Share Posted June 13, 2021 22 hours ago, Quistessa said: Fiiiine. . . Rotating the sliced cylinder (left) and Quistessa's script (works like magic!) 👍 2 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