Tibbybob Posted December 15, 2011 Share Posted December 15, 2011 Hi, I want a child prim to rotate relative to the direction the root prim is "facing". The root prim will be in motion, constantly changing direction with some up and down movement; the child prim needs to follow the root prim on x and y (it's at the front of the root prim) but rotate at its center on z to a certain number of degrees to the left or right of the root's direction.I have tried to understand and follow some different examples that I found here and on the SL wiki, but the more I try the worse it gets :(Thanks for any and all help! Link to comment Share on other sites More sharing options...
Dora Gustafson Posted December 15, 2011 Share Posted December 15, 2011 Please make a distinction between rotate (llSetRot(), llGetRot() etc.) and spin (llTargetOmega()) What is it in this case? Link to comment Share on other sites More sharing options...
Tibbybob Posted December 15, 2011 Author Share Posted December 15, 2011 I have been trying to use llSetLocalRot() and llGetRootRotation(). I just read through the wiki page on Rotation again but there is so much information there that I am not sure I am on the right track. Link to comment Share on other sites More sharing options...
Rolig Loon Posted December 15, 2011 Share Posted December 15, 2011 If I understand correctly, you are setting the child prim's local rotation, and you want it to match the root's global rotation, plus or minus a perturbation. So try something like llSetLinkPrimitiveParamsFast(child_link_no,[PRIM_LOCAL_ROT, llEuler2Rot(perturbation_rot)*llGetRot()]); If your perturbation is a +/- 10 degree rotation around the child prim's Z axis, you might write it as vector perturbation_rot = <0.0,0.0,10.0 - llFrand(20.0)>*DEG_TO_RAD ; You'll need to update that everytime the root prim rotates, so put both in a timer event with a suitably short time frame. ETA: OK, so that wasn't right, but this is .... integer gON;default{ touch_start(integer total_number) { llSetTimerEvent(0.3 * (gON = !gON)); } timer() { vector perturbation_rot =<0.0,0.0,10.0-llFrand(20.0)>*DEG_TO_RAD ; llSetLinkPrimitiveParamsFast(2,[PRIM_ROT_LOCAL, llEuler2Rot(perturbation_rot)]); llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_ROTATION,llEuler2Rot(<0.0,0.0,2.0>*DEG_TO_RAD)*llGetRot(),PRIM_POSITION,llGetPos() + <0.0,0.0,0.5-llFrand(1.0)>]); }} Tested it in world. The two-prim linkset bounces up and down randomly and the orbiting child prim wobbles back and forth on its own Z axis, like Earth's Moon with its axial perturbations. It's pretty cool. 1 Link to comment Share on other sites More sharing options...
Tibbybob Posted December 16, 2011 Author Share Posted December 16, 2011 That's great! Thank you!!! Plus, I learned a new word :matte-motes-wink: 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