Chem Cosmo
Registered User
Join date: 22 Apr 2005
Posts: 104
|
10-10-2005 11:42
Does anyone know where I can find a script for a rocking chair? I have looked everywhere and am not seeing anything. Any help would be appreciated.
Thanks,
Chem
|
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
|
10-10-2005 16:19
Below is a basic non-physical swing script. It's one that was published here a while ago, and I can say it works, although it isn't the smoothest swing ever. If you get the root prim in the right place (?the seat maybe) and twiddle with the constant vector normal you should be able to get something to start you on your way. rotation Inverse(rotation r) { r.x = -r.x; r.y = -r.y; r.z = -r.z; return r; } rotation GetParentRot() { return Inverse(llGetLocalRot())*llGetRot(); } SetLocalRot(rotation x) { llSetRot(x*Inverse(GetParentRot())); }
vector normal = <1.5, 0.0, -1.75>;
default { state_entry() { @a; SetLocalRot(llEuler2Rot(<normal.x, normal.y, normal.z + 1>)); SetLocalRot(llEuler2Rot(normal)); SetLocalRot(llEuler2Rot(<normal.x, normal.y, normal.z - 1>)); SetLocalRot(llEuler2Rot(normal)); jump a; }
}
|
Chem Cosmo
Registered User
Join date: 22 Apr 2005
Posts: 104
|
10-10-2005 16:41
Thank you so much for your help 
|
Sue Stonebender
Piano Craftsman
Join date: 7 Jan 2005
Posts: 219
|
Timing ...
10-15-2005 21:38
Hello, Eloise :^)
Is there any way to slow this down? Would it require a timer? The animation sequence is pretty rapid.
Thanks a bunch!
Sue.
|
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
|
10-16-2005 10:51
There's quite a few ways to do it - the script I provided does work and should show you one way you can achieve the results, but it's far from perfect.
llSleep() or timers or more steps or some combinations would all be good.
I actually typically use a 12 step programme, and a bit of fun maths with sines to determine how far from 0 (straight down) to the maximum deflection forward and back (so you get 3 going forward, then 6 back then 6 forward, 6 back, 6 forward etc.) which gives a reasonably smooth swing, and put it in a timer, so I can turn the swing on and off.
But without knowing precisely what you want and how it's all to be implemented it's hard to say, if you're sticking with miminal changes to that script I gave you and can cope with the abrupt motion I'd suggest llSleep after each of the movement lines.
|