Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Question about swing/rocker script

Poppet McGimsie
Proprietrix, WUNDERBAR
Join date: 28 Jul 2006
Posts: 197
10-25-2006 10:18
I found the script below here on the forums (from Eloise Pasteur, at /54/74/65100/1.html) and I have a couple of questions about it that I am hoping one of you scripting gurus can answer:

1) even though I put in lots of positions, the swing reverts to far fewer when it is running in the world (oddly it runs the way it is supposed to when the edit window is open). I read somewhere here that's a well known bug, but I have seen smoother swing/rocker scripts. Does anyone know of a smoother script, or how to fis this one so it is smoother?

2) the way the script is now, it will always face only one direction when it swings. So if I place it N/S and click it to swing, it will turn to face E/W. The only way to change that is to alter the vector normal in the code and recompile. This is kind of a pain, especially for people who aren't comfortable with LSL.

Can anyone see an easy way of changing the code so that the swing will swing whatever direction you set it out, without having to change the vector normal in the code? Is there a "get orientation" LSL command or something?

THANKS!!!!!!

CODE

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;
}

}
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
10-25-2006 14:59
I have an answer... I sell it in world or from SLB and SLEx.

Given that I still make money from it quite regularly, I'd rather not share it, but the script is full perms so you can make stuff to sell so you can see how I did it.
_____________________
Eloise's MiniMall
Visit Eloise's Minimall
New, smaller footprint, same great materials.

Check out the new blog
Poppet McGimsie
Proprietrix, WUNDERBAR
Join date: 28 Jul 2006
Posts: 197
10-25-2006 22:21
Thanks so much! I will find it!