|
Baron Hauptmann
Just Designs / Scripter
Join date: 29 Oct 2005
Posts: 358
|
01-21-2008 09:34
I am trying to get a child prim to rotate around an arbitrary axis fed by another script in a linkset. I generally do pretty well at math, but for some reason rotations drive me NUTS. I can get the following code to work as long as all prims in the linkset have zero rotation. But as soon as I rotate the one this code is in, it seems to have a completely different axis. I'm obviously not taking into account the local rotation correctly, but I just cannot figure out how to do it right! Any help out there? This code is loosely based on something posted awhile back by Joannah Cramer, /54/87/134397/1.html rotate( rotation Spin ) {
vector newPos = ( llGetLocalPos() - offset ) * Spin; llSetPrimitiveParams( [ PRIM_POSITION, offset + newPos, PRIM_ROTATION, llGetRot() * Spin ] ); }
move(vector offset) { offset = offset - llGetLocalPos();
rotation spin; integer i; if (!bOpen) { vBase = llGetLocalPos(); rBase = llGetLocalRot(); spin = llAxisAngle2Rot( <0.0, 0.0, 1.0> , (9 * DEG_TO_RAD) ); // rotate in 10 steps on (local) Z axis for( i = 0; i < 10; ++i ) { rotate( spin ); }
} else if (bOpen) { spin = llAxisAngle2Rot( <0.0, 0.0, 1.0>, (-9 * DEG_TO_RAD) ); // rotate back for( i = 0; i < 10; ++i ) { rotate( spin ); } llSetPos(vBase); llSetLocalRot(rBase); } bOpen = !bOpen; }
|
|
Screwtape Foulsbane
Registered User
Join date: 30 Dec 2007
Posts: 134
|
01-21-2008 09:42
Unfortunately that's what happens using llSetPrimitiveParams on child prims. You have to resort to using only llSetLocalRot.
S
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
01-21-2008 09:48
jira actricle SVC-93 bites again... the workarounds for set prim params can be found at https://jira.secondlife.com/browse/SVC-93
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
01-21-2008 10:58
Wow. I ran into this way back when I first joined SL (and it had already been reported then). Weeeeeee! You'd think it would be a little higher on the priority list.
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
01-21-2008 11:53
it's been mostly ignored, because people have built a lot of content that would break relying on the current behavior, and apparently no one wants to code a replacement function to legacy the old one
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
01-21-2008 12:08
Grrrr. I'd do it. I've had plenty of vector mathematics, and it's the fun stuff. Hmph.
|