Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Rotation 'Follow' Chain

Tazmania Trefusis
Registered User
Join date: 13 Jan 2008
Posts: 85
04-16-2008 08:50
I have a slow rotation script. If i was then to put that rot script into one of say 3 cubes (top or bottom but not middle), which were vertically on top of eachother. How could I get the other 2 cubes (or whatever I shape I decide) to follow the lead cube but a fraction behind. Hopefully, if solved, this would make all 3 cubes rotate but the other 2 would follow just behind. So all 3 cubes would be in sync but each one (wether going up the chain or down the chain) would be slightly behind the previous cube by say 5 or 10 degrees - or +.

All running exactly the same speed. Then if I was to experiment with speed settings on the 'master' cube, all the others would follow in same matching speed but slightly behind in its 360 position. Each cube cant be doing its own thing, otherwise the effect gets ruined. It should look like their connected via gears but each subsequent level would be offset just a tad.

This would presumably require some rot position variable being carried over to the other cubes (from the master cube) and say -5 or -10 degress been taken off for its current rot position. Then again..another -5 or -10 degrees taken off on the next level and so on
I could just put a slow rotation script in each cube/shape and it would look fine for a bit but then knowing SL, it would lose sync or even if I editted one of the cubes, it would stop and then start after i finished..in which case the results would look crap as each cube would be doing its own thing and I would lose the 'flow'

So, in an ideal world, I start rotation (either via local channel command or menu) and the 'master' cube would start to rotate slowly. Then when it was say 5-10 degrees into its rotation, the 2nd cube would start, then when that was 5 or 10 degrees into its rotation, the 3rd cube would then start.
Finally when the 'master' or 'lead' cube is stopped (again either via local channel command or menu) the others would eventually stop when they matched the master cube in its 360 rotation position. Just having 3 cubes all linked and offset to eachother by 5-10 degrees wouldnt work as they'd all stop and start at the same time.
I need a sort of 'follow' feature.

Is there anything already in existence?..bearing in mind Im a total script noob. Im sure a similar scenario has probably popped up before hand.

These cubes will eventaully be more than 1 prim but Im using a cube just for example purposes.

Speed (for master cube) and offset (for remaining cubes) by degrees or a value would ideally be adjustable

All rotations would be 1 axis only and horiz (parallel to the ground)

Would appreciate any ideas, help etc

Thanks
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
04-16-2008 10:53
Is there a reason the cubes can't be linked? If you can link them into one object, simply offset the top cubes' rotations as you want, and only rotate the root prim (whole object).
Tazmania Trefusis
Registered User
Join date: 13 Jan 2008
Posts: 85
04-16-2008 11:01
That would be the very simple solution but I dont want them moving as one big giant static object. I need the other cubes to follow just behind and stop n start when they reach the 'master' cube's position and not time. This would presumably be seconds, minutes or even hours depending on how slow the overall rotation is

So ideally...master cube would start to rotate and then 2nd cube (if offset was set 10 degrees) would start to rotate when master cubes reaches 010 degree pos. Then 3rd cube would start when master cube reached 020 and 2nd reached 010.
Also the same when stoping...just in reverse. All cubes would eventually stop when reaching 000 degrees (or whatever master cube stopped at)

Taz
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
04-16-2008 11:07
Ah. I see. I would, instead of thinking of it in terms of angle offsets, think of it in terms of time delays. If the rotation is started based on some event, give each of the cubes a different delay (llSleep() or a timer) before starting their (probably llLookAt() or llRotLookAt()) rotations. Otherwise make the parameters of the rotation the same.
Darien Caldwell
Registered User
Join date: 12 Oct 2006
Posts: 3,127
04-16-2008 13:26
If you are trying to make an analog clock, there are some nice (and free!) scripts in the Scripting library for doing this. :) At the very least, I'm betting one of these could be modified to do what you want.
_____________________
Tazmania Trefusis
Registered User
Join date: 13 Jan 2008
Posts: 85
04-16-2008 14:08
Nope...not making a clock but I can see what your saying, the scripts would be I dare say similar.
In fact, I would think my 'use' would be easier than a clock script as all the rotations are the same speed!!
No hour, minute & second rotations to deal with.
(not that I'm making any assumptions that scripting is easy because most of it is way over my head!)

You mean the wiki scripting library?
Darien Caldwell
Registered User
Join date: 12 Oct 2006
Posts: 3,127
04-17-2008 12:03
Nope, I mean here, in the forums:

/15/1.html
_____________________