Reply
Honored Resident
MsReality
Posts: 20
0 Kudos

rotation script help

I'm building a water feature that has three cylinder prims stacked one on top of the other and connected.  The prims have been set so the two on top are the child prims and the bottom prim is the parent.  I'm attempting to have the two on top rotate ... one to the right and one to the left.  Each child prim has multiple prims attached that appear to be water spouting from them.  All of these prims sit in a base that looks like water within a marble tub. 

 

I looked at different tutorial sites and thought I had found one with simple instructions to have the two top cylinders rotate and followed the instructions specifically, however, it is not functioning correctly.  Could you look at my script and tell me what elements I am missing or what I could do differently to make this work as I have envisioned it to work.

{   

    state_entry()

           

    {
llSetPos(llGetPos()+<-1,0,0>);

    //multiply desired
rotation (<x,y,z>) with local rotation of parent, rate is PI, gain is
1.        llTargetOmega(<0,0,0> *
llGetLocalRot(),PI,1.0);    

    }

     

}

 

Also, I would like to add the element of water particles in the air from the rotation.

 

Thank you for you assistance.

MsReality

Rolig Loon
Posts: 24,619
Registered: ‎10-05-2009
0 Kudos

Re: rotation script help

Reply to MsReality - view message

Well, you won't be able to do all of that, but you can at least get the basics to work.  Try this ...

default
{
    state_entry()
    {
        llSetLinkPrimitiveParamsFast(2,[PRIM_OMEGA,<0.0,0.0,1.0>,0.3,0.3]);
        llSetLinkPrimitiveParamsFast(3,[PRIM_OMEGA,<0.0,0.0,1.0>,-0.3,0.3]);
    }
}

 That will rotate your top cylinder one direction and the middle cylinder the opposite direction.  Unfortunately, though, you can't link anything to either of those prims and expect them to rotate with it.  PRIM_OMEGA (or the parent function, llTargetOmega) affects only that one prim, unless you put it in the root prim and expect it to rotate the entire object.  You have only two solutions that I can think of:

1. Don't link your three cylinders at all.  Make each of them an independent object, maybe with attached gargoyles, and make each entire object spin with a simple llTargetOmega script like the one in your inventory >>. Library >> Scripts folder.

2. Make the middle and top cylinders sculpties, complete with all of its extras, so that each is a single prim.  That's a bit of work, but it could look cool.

(I'm not even going to suggest llSetRot, which would not only be a nasty bear to script, the result would look choppy and very unsatisfactory.)

For spouting particles, study llParticleSystem or -- even better -- visit the Particle Lab in world and do their tutorials to learn how it's done.  That's how most of us learned.

Not as dumb as I look
Chelsea Malibu
Posts: 1,712
Registered: ‎10-05-2009
0 Kudos

Re: rotation script help

[ Edited ]

Reply to MsReality - view message

It looks like you are trying to link them all?  That wont work.  A child prim will not carry additional prims that rotate as they will only move themselves and not any attached prims where a parent prim will rotate anything attached to it.

However, there are some tricks to emulate this.  Try using a texture animation instead.  As with some of my ceiling fans, I have an animated texture for my fan blades that then rotate around a parent prim that rotates.  It creates the look of having multiple movements where it really a trick with animated textures.

Honored Resident
MsReality
Posts: 20
0 Kudos

Re: rotation script help

Reply to Chelsea Malibu - view message

Thank you for the input... I thought that might be part of the issue.  However, I took just two simple prims off in a close area and still couldn't get them to rotate.  I will try again.

Honored Resident
MsReality
Posts: 20
0 Kudos

Re: rotation script help

Reply to Rolig Loon - view message

Thank you for the input.  Your reply has been very helpful.  I liked your suggestions and  will copy it onto word and use it as I work through my project.  You input has been greatly appreciated!

Honored Resident
MsReality
Posts: 20
0 Kudos

Re: rotation script help

Reply to Rolig Loon - view message

I'm unsure which prim to put the scripting into that you gave me?

Honored Resident
MsReality
Posts: 20
0 Kudos

Re: rotation script help

Reply to Rolig Loon - view message

I built 3 prims (two copied from the first) then inserted the script below that you gave me... first into one on the top then into all three... then just the bottom one... then tried linking them... they still don't rotate... hmmmmmm  I must still be doing something wrong?

Can you add some advice ... I'm a novice so I'm not certain if I'm doing something wrong or missing a step.  Thank you for your help!

default
{
    state_entry()
    {
        llSetLinkPrimitiveParamsFast(2,[PRIM_OMEGA,<0.0,0.0,1.0>,0.3,0.3]);
        llSetLinkPrimitiveParamsFast(3,[PRIM_OMEGA,<0.0,0.0,1.0>,-0.3,0.3]);
    }
}

Rolig Loon
Posts: 24,619
Registered: ‎10-05-2009
0 Kudos

Re: rotation script help

[ Edited ]

Reply to MsReality - view message

Link all three... root prim on the bottom, and put the script in the root prim.  I just sent you one in world as a demo.

 

Not as dumb as I look
Honored Resident
MsReality
Posts: 20
0 Kudos

Re: rotation script help

Reply to MsReality - view message

OMG Thank you!

Honored Resident
MsReality
Posts: 20
0 Kudos

Re: rotation script help

Reply to MsReality - view message

I do not have them connected and they still rotate so I added one of my water prims to it and it rotates with the prim... I am so stoked!  Now all I need to do is figure out how to add water particles around the fountain?  Any advice?  I sooooooooo appreciate what you've done to help me tonight!!!