Jump to content
Maelstrom Janus

Help with rotation components.

Recommended Posts

Hello Im trying to find a way of rotating a component in my build once it's no longer 'parallel' with the three axes - I'm no scripter - not learned yet - and so Im wading through the terminology to try and make things work. Currently using all the rotation scripts I have if I duplicate the part and move it so its no long parallel the rotation immediately goes wild.

I found a script which would work apart from the fact it only seems to work with two prims....those prims with no script in them dont revolve.. the script claims its good for propellors ...Im wondering how (unless one of the compents is a sculptie) you make a propellor from two prims....can anyone please tell me how I appy this to a build with several prims... Thanks

 //Rotates very slowly around a cylinder's local or global Z axis
 // .... Good for making a propeller that rotates regardless of initial orientation.
 
default
{
    state_entry()
    {
       llTargetOmega(llRot2Up(llGetLocalRot()), PI, 1.0);
    }
}

Share this post


Link to post
Share on other sites

If you use llTargetOmega in a script that's in the root prim, the entire linkset will revolve.  If you put it in a child prim, only that prim will revolve. In this particular case, if you want the item to revolve around whatever its local rotation axis it now, don't apply llRot2Up.  That ought to work.

Now, for propellers ... in the old days we used to make propellers by taking a flattened cube prim and applying some twist.  They were pretty crummy looking propellers, though, even if you added a texture to round off the funky sharp corners.  I wouldn't do it that way today.  Just make a simple mesh propeller.  It will have lower L.I. and look loads better.

Share this post


Link to post
Share on other sites
18 minutes ago, Rolig Loon said:

If you use llTargetOmega in a script that's in the root prim, the entire linkset will revolve.  If you put it in a child prim, only that prim will revolve. In this particular case, if you want the item to revolve around whatever its local rotation axis it now, don't apply llRot2Up.  That ought to work.

Now, for propellers ... in the old days we used to make propellers by taking a flattened cube prim and applying some twist.  They were pretty crummy looking propellers, though, even if you added a texture to round off the funky sharp corners.  I wouldn't do it that way today.  Just make a simple mesh propeller.  It will have lower L.I. and look loads better.

If you put the script into the root prim the build will revolve around the root prims axes as long as they are parallel with the regions/worlds axis - move the build so theyre not parallel  and the rotation goes totally askew....How do I not apply rot2 up ? Im not a scripter and the minute I tried to remove that from the script good old syntax errors.... Thanks for you help.

 

Edited by Maelstrom Janus

Share this post


Link to post
Share on other sites
llTargetOmega(llRot2Euler(llGetLocalRot()), PI, 1.0);

I take that back.  That's not going to work in this case.   Let me think.....

Edited by Rolig Loon

Share this post


Link to post
Share on other sites

llTargetOmega sucks when you want to rotate the prim while it's spinning. It's often seen on cars where the front wheels start wobbling when turning the steering wheel.

To keep spinning child prims spinning in alignment, the spin will have to be stopped before it's rotated, and restarted afterwards. like so:

default
{
    state_entry()
    {
       llTargetOmega(<0,0,1> * llGetLocalRot(), PI, 1.0);
    }
    
    touch_start(integer t)
    {
        llTargetOmega(<0,0,0>, 0.0, 0.0);
        llSetLocalRot(llEuler2Rot(<45,0.0,0> * DEG_TO_RAD) * llGetRot());
        llTargetOmega(<0,0,1> * llGetLocalRot(), PI, 1.0);
    }      
}


 

Share this post


Link to post
Share on other sites
16 minutes ago, arton Rotaru said:

To keep spinning child prims spinning in alignment, the spin will have to be stopped before it's rotated, and restarted afterwards.

Not quite true.  In this case, if the OP simply wants to keep the propeller spinning around its own X axis, he just needs

            llTargetOmega(<1.0,0.0,0.0> *llGetLocalRot(),PI,1.0);

It doesn't matter how the vehicle turns, the propeller will keep rotating around its own X axis.   And if he wants it to rotate around some other axis, he needs to just change the vector in that function.  So rotating around the Y axis, for example, is

            llTargetOmega(<0.0,1.0,0.0> *llGetLocalRot(),PI,1.0);

Edited by Rolig Loon

Share this post


Link to post
Share on other sites
1 minute ago, Rolig Loon said:

Not quite true.  In this case, if the OP simply wants to keep the propeller spinning around its own X axis, he just needs

I should have made that more clear probably. I thought the example of a cars front wheels would make my point clear, but it probably didn't :/.

Share this post


Link to post
Share on other sites

Yeah, the business about the car's front wheels is more complicated, because you are rotating the wheel axis relative to the car, which may also be turning.  There, you do have to keep updating with a timer.  (Or rotate the texture on the wheels instead of using llTargetOmega to rotate the wheels on the wheel axis, or throw up your hands and walk away.)

Share this post


Link to post
Share on other sites

Yeah I know. Actually I posted because I didn't wanted Maelstrom to be left of with this.:P

 

46 minutes ago, Rolig Loon said:

llTargetOmega(llGetLocalRot(), PI, 1.0);

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...