Jump to content

Change Local Rot of Single or Main Prim?


BrownBoxStudio
 Share

You are about to reply to a thread that has been inactive for 3189 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

So I am working on creating a door script that will have a prim rotate around it's local axis despite it's initial starting angle. Except I am having issues with getting a single prim or main prim to rotate around it's local axis. The script works for child prims works beautifully but I can only get a main or single prim to use the sims axis.

This is what I am using for the child prims and it's successful. I have tested many combinations of llGetRot, PRIM_ROTATION, llGetLocalRot, for a main or single prim, to no success. I am either missing a combination or have done something wrong. Any suggestions on what I can try? Thanks for your time. Any help is appreciated. 

 

if ( touch_count == 0) 
    {
        llSetLinkPrimitiveParamsFast(llGetLinkNumber(), [PRIM_ROT_LOCAL, llGetLocalRot()*open_rot]);
        llPlaySound( open_sound, volume);
        touch_count++;
    }
else 
    {
        llSetLinkPrimitiveParamsFast(llGetLinkNumber(), [PRIM_ROT_LOCAL, llGetLocalRot()/open_rot]);
        llPlaySound( close_sound, volume);
        touch_count = 0;
    }
}
Link to comment
Share on other sites

Still only acting upon the sims axis and not local axis. In testing I'm not seeing a difference between PRIM_ROTATION and PRIM_ROT_LOCAL or llGetRot() and llGetLocalRot() when used on the root prim, at least in my current use.

 

Edit: So I noticed the cavaet that PRIM_ROTATION is always the global rotation and it says to use PRIM_ROT_LOCAL but as I said that doesn't work either.  Z is always up despite the prims Z up not facing up. 

 

Is there an issue with using llSetLinkPrimParams on a root prim? 

Link to comment
Share on other sites

This is a bit spicy
I would say that a root prim has a local rotation of ZERO_ROTATION, always
and it makes no sense to talk about a local rotation for the root prim
We can talk about which axis to rotate: X, Y or Z

You could try to insert ZERO_ROTATION in the code:

llSetLinkPrimitiveParamsFast( LINK_ROOT, [PRIM_ROT_LOCAL, ZERO_ROTATION*open_rot]);// andllSetLinkPrimitiveParamsFast( LINK_ROOT, [PRIM_ROT_LOCAL, ZERO_ROTATION/open_rot]);

But this will rotate the whole link-set not just the root

:smileysurprised::):smileyvery-happy:

  • Like 1
Link to comment
Share on other sites

@Rolig: That does it, exactly what I've been trying to do. Thats an amazing script. Thanks so much. Now I just have to study and figure out why that scripts works. I came to realize it was more complex than I thought.

 

@Dora: You seem to have it right but in the script rolig linked to the ZERO_ROTATION is taken away and then added to the local rot. If I at least understand that correctly. 

 

Thanks for all the help!

 

Edit: I'm actually a bit confused. Maybe someone would care to explain? The only different I see in the script solution vs what I did was setting the rotation angle to be (angle = (zero_rotation/angle)) What is the zero_rotation adding into the equation that I was missing? It doesn't even need a second llSetLocalRot to change the door angle back which amazes me even more. 

Link to comment
Share on other sites

 

BrownBoxStudio wrote:

 

Edit: I'm actually a bit confused. Maybe someone would care to explain? The only different I see in the script solution vs what I did was setting the rotation angle to be (angle = (zero_rotation/angle)) What is the zero_rotation adding into the equation that I was missing? It doesn't even need a second llSetLocalRot to change the door angle back which amazes me even more. 

ZERO_ROTATION/rot inverts rot.  See the section Using Rotations in the wiki article on Rotation, whiich repays careful study.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3189 days.

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
 Share

×
×
  • Create New...