Carbon Philter Posted March 4, 2015 Share Posted March 4, 2015 I'm still trying to master rotations and thought I had it nailed but yet again find I'm missing something, and would appreciate assistance.I want to have a child prim emitting particles in the xy plane relative to a vehicle's root prim which has no variation in its z axis - boat and propeller wake - but need to have the option to rotate the wake emitter to face either directly forward or backwards. Hope that makes sense!I knocked up a test rig and put a toggle script in the child prim to check it out and it almost works. The emitter prim rotates forward/backward as required, whatever the root prim's horizontal direction , but with the script as written the child emitter prim is rotating around it's own z axis as the root prim faces different directions in the xy plane, and that skews the angle emission of the particles, and I need to avoid that.here's the almost working tester:integer switch; vector input; default { touch_start(integer total_number) { switch = !switch; rotation quat = llEuler2Rot(input); if (switch==TRUE) { input = <0, 3*PI/2, 0> ; llOwnerSay("Touched."); } else if (switch==FALSE) { input = <0, PI/2, 0> ; } llSetLinkPrimitiveParamsFast(2, [PRIM_ROT_LOCAL, llGetLocalRot()*quat]); } } It's got to be something straightforward in the relationship between the local rotations of the root and child but so far I can't grasp it. Help!!ThanksCarbon Link to comment Share on other sites More sharing options...
Dora Gustafson Posted March 4, 2015 Share Posted March 4, 2015 My first guess is you shall omit the llGetLocalRot() Just write: llSetLinkPrimitiveParamsFast(2, [PRIM_ROT_LOCAL, quat]); :smileysurprised::smileyvery-happy: Link to comment Share on other sites More sharing options...
Rolig Loon Posted March 4, 2015 Share Posted March 4, 2015 Unless I am misunderstanding your setup, all you need to do is get the local rotation of the child prim (not llGetLocalRot(), which is the local rotation of the root), and apply it. Something like this ... integer switch;default{ touch_start(integer total_number) { vector input = <0, (2*(switch = !switch)+1)*PI/2, 0> ; rotation quat = llEuler2Rot(input); rotation rLoc = (rotation)llList2String(llGetLinkPrimitiveParams(2,[PRIM_ROT_LOCAL]),0); llSetLinkPrimitiveParamsFast(2, [PRIM_ROT_LOCAL, rLoc*quat]); }} Edit: Which is what Dora said while I was typing.^^ :smileyvery-happy: Link to comment Share on other sites More sharing options...
Carbon Philter Posted March 4, 2015 Author Share Posted March 4, 2015 Many thanks, Dora. Got it in one! I was continuing tests and set up another rig but did it the 'old fashioned way' using llMessageLinked and then used that to set the child's local rot. Maybe not the tidiest of script solutions but got that way to work! vector input;integer switch;default{ link_message(integer sender_num, integer num, string msg, key id) { if(msg = "rotate") { switch = !switch; if (switch==TRUE) { input = <0, -PI/2, 0> ;} else if (switch==FALSE) { input = <0, PI/2, 0> ; } llSetLocalRot( llEuler2Rot(input)); }} Guess it's a combination of the rotation function and using the LinkPrimParametersFast function I need to get my head round. Maybe overcomplicating things through ignorance. :matte-motes-dont-cry: Thanks again. Carbon Link to comment Share on other sites More sharing options...
Carbon Philter Posted March 4, 2015 Author Share Posted March 4, 2015 Also, thanks, Rolig. Link to comment Share on other sites More sharing options...
Innula Zenovka Posted March 4, 2015 Share Posted March 4, 2015 One significant difference between your two versions is that, in the first, you say rotation quat = llEuler2Rot(input); before you've assigned any valute to input. I think this means that your code actually means llSetLinkPrimitiveParamsFast(2, [PRIM_ROT_LOCAL, llGetLocalRot()*ZERO_VECTOR]); regardless of what value is assigned to input. In your second example, with the link messages, you (correctly) assign a value to input and then convert it to a rotation. 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