1

I am using LSL (Linden Scripting Language) in Second Life. I have imported a virtual (mesh) aircraft object and spent hours animating various parts such as canopy and undercarriage.

I have now discovered that I should have imported the object to face east when all axis are set to zero (mine was facing west). I have now re-imported the object with the correct orientation, however as the main mesh object was my 'root prim' and the frames storing the positions of every animated part was relative to that, all the animated parts (child prims) are now reversed by exactly 180 degrees.

Does anyone know of a way I could parse the script data to find and automatically add a correction of 180 degrees?

I spent hours on the animations and have pages of data, so an automated solution would be extremely preferable and any help gratefully received.

A snippet of the code I need to parse is reproduced below:

    link_message(integer n, integer c, string m, key id){
    vector lSize = llList2Vector(llGetLinkPrimitiveParams(1,[7]),0);
    if(m == lAnimName + "|0"){// Frame 0.

        if(lLeg3t)
            llSetLinkPrimitiveParamsFast(lLeg3t,[

                33, <0.245628*lSize.x, -0.183868*lSize.y, -0.184195*lSize.z>, 29, <-0.500000, 0.000000, -0.707107, 0.500000>

            ]);

        if(lWire3t)
            llSetLinkPrimitiveParamsFast(lWire3t,[

                33, <0.259854*lSize.x, -0.187642*lSize.y, -0.196354*lSize.z>, 29, <-0.500000, 0.000000, -0.707107, 0.500000>

            ]);

        if(lWire3b)
            llSetLinkPrimitiveParamsFast(lWire3b,[

                33, <0.244813*lSize.x, -0.194661*lSize.y, -0.171052*lSize.z>, 29, <0.073912, -0.549525, -0.444997, 0.703233>

            ]);

        if(lFoot3)
            llSetLinkPrimitiveParamsFast(lFoot3,[

                33, <0.261851*lSize.x, -0.180508*lSize.y, -0.157508*lSize.z>, 29, <-0.270598, -0.270598, -0.653282, 0.653282>

            ]);

        if(lLeg3b)
            llSetLinkPrimitiveParamsFast(lLeg3b,[

                33, <0.247470*lSize.x, -0.200321*lSize.y, -0.190136*lSize.z>, 29, <0.073912, -0.549525, -0.444997, 0.703233>

            ]);

        if(lSled3)
            llSetLinkPrimitiveParamsFast(lSled3,[

                33, <0.251954*lSize.x, -0.184123*lSize.y, -0.169543*lSize.z>, 29, <0.000000, 0.000000, -0.707107, 0.707107>

            ]);

        if(lWire2t)
            llSetLinkPrimitiveParamsFast(lWire2t,[

                33, <0.268535*lSize.x, 0.190722*lSize.y, -0.196969*lSize.z>, 29, <-0.061628, 0.541675, -0.454520, 0.704416>

            ]);

        if(lLeg2t)
            llSetLinkPrimitiveParamsFast(lLeg2t,[

                33, <0.255244*lSize.x, 0.185132*lSize.y, -0.176223*lSize.z>, 29, <-0.061628, 0.541675, -0.454520, 0.704416>

            ]);

        if(lWire2b)
            llSetLinkPrimitiveParamsFast(lWire2b,[

                33, <0.237334*lSize.x, 0.180499*lSize.y, -0.159385*lSize.z>, 29, <0.517145, -0.024678, -0.706676, 0.482246>

            ]);
Angel
  • 11
  • 2
  • For the future, please use flag names and not their values. It makes your code harder to read (LINK_ROOT, PRIM_SIZE, PRIM_POS_LOCAL and PRIM_ROT_LOCAL) and comes without a performance cost. – BlindWanderer May 02 '16 at 01:25

2 Answers2

0

I'm no scripter but, I think I kinda get what's going on....

Try this - import your vehicle in Blender. Select all the parts, making sure your vehicle is facing the correct direction. If it's not, hit R, then Z, then the number of the degrees you want it to rotate, then Enter.

Once the vehicle is facing the correct direction. Hit Ctrl-A and select 'Rotation' in the pop up menu. This resets the rotation data all to 0. Export your object and upload it. You'll find when you rezz it that the rotation of all the parts are now set to 0.

If I understand your quandry correctly that should resolve the rotation issue of the child prims?

If not...see what happens when scripting noobs try to be helpful? =/

0

My recollection is if you flip the sign on any single non-zero quaternion component it will flip the rotation 180 degrees.

So...

   if(lLeg3b)
        llSetLinkPrimitiveParamsFast(lLeg3b,[

            33, <0.247470*lSize.x, -0.200321*lSize.y, -0.190136*lSize.z>, 29, <0.073912, -0.549525, -0.444997, 0.703233>

        ]);

becomes:

    if(lLeg3b)
        llSetLinkPrimitiveParamsFast(lLeg3b,[

            33, <0.247470*lSize.x, -0.200321*lSize.y, -0.190136*lSize.z>, 29, <-0.073912, -0.549525, -0.444997, 0.703233>

        ]);