Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Touch Rotation Script Needed

bargain Walcott
Registered User
Join date: 31 Oct 2005
Posts: 248
03-25-2006 17:46
Trying to add the option of touching the object to turn the rotation on or off. Here's the rotation script I'm using.

default
{
state_entry()
{
llTargetOmega(<0,0,.1>,-PI_BY_TWO,1.0);
}

}

Would also like it so anyone can touch for on/off.

Thanks
Leonard Churchill
Just a Horse
Join date: 19 Oct 2005
Posts: 59
03-25-2006 20:20
Here's a *little* help. Rotation is not my forte.

CODE

default
{
touch_start(integer total_number)
{
if (llGetOmega() != <0,0,0>)
{
llTargetOmega(<0,0,.1>,0,0);
}
else
{
llTargetOmega(<0,0,.1>,-PI_BY_TWO,1.0);
}
}
}


Behaviour about the command is here: http://secondlife.com/badgeo/wakka.php?wakka=llTargetOmega

And, I heartily encourage you to look into the many free Introduction to Scripting classes there are in world. =)
Gigs Taggart
The Invisible Hand
Join date: 12 Feb 2006
Posts: 406
03-25-2006 22:48
This may not be the prettiest way but here's what I use on my GT sign.

CODE
integer gOn=FALSE;
default
{
state_entry()
{
llTargetOmega(<0,0,2.5>, 0, 0);
}

touch_start(integer total_number)
{
if (gOn)
{
llTargetOmega(<0,0,2.5>, 0, 0);
gOn=FALSE;
}
else
{
llTargetOmega(<0,0,2.5>, 0.25, 0.25);
gOn=TRUE;
}
}
}
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
03-26-2006 07:12
Try this:
CODE
default
{
state_entry()
{
state stopped;
}
}

state stopped
{
state_entry()
{
llTargetOmega(<0,0,2.5>, 0, 0);
}

touch_start(integer total_number)
{
state spinning;
}
}

state spinning
{
state_entry()
{
llTargetOmega(<0,0,2.5>, 0.25, 0.25);
}

touch_start(integer total_number)
{
state stopped;
}
}
bargain Walcott
Registered User
Join date: 31 Oct 2005
Posts: 248
03-26-2006 09:26
Cool, all the scripts suggested worked great! Looks so simple know that I see it done.

Thanks much all, I'm grateful :)
PetGirl Bergman
Fellow Creature:-)
Join date: 16 Feb 2005
Posts: 2,414
03-26-2006 09:50
Wow this was fun!!

****

How do I change the speed?


How do I change the rotation.. from now anticlockwise to clockwise?

Tina (PetGirl Bergman) – The Lady of Light.

....................................................................................................

[EXAKT]

Bring some light into you (second) life!
Exclusive modern lamps of all kinds, indoor and garden furniture,
stylish scripted fans, tables, vases,and rugs.

Made in Sweden, in Quality, in Style and EXAKT!

Visit the [EXAKT] stores in (MAIN STORE) Verloren (216, 30, 33)
and PrimADonna (71, 120, 26)
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
03-26-2006 11:02
From: PetGirl Bergman

How do I change the speed?

CODE

float MIN_RATE = 0.25; // start at 4 seconds per cycle
float MAX_RATE = 10; // go up to 10 cycles per second
float rate;
float spin(float hertz)
{
llTargetOmega(<0,0,1>,TWO_PI*hertz,1);
}

default
{
state_entry()
{
state stopped;
}
}

state stopped
{
state_entry()
{
spin(0);
}

touch_start(integer total_number)
{
rate = MIN_RATE;
state spinning;
}
}

state spinning
{
state_entry()
{
spin(rate);
}

touch_start(integer total_number)
{
if(rate < 1) rate *= 2;
else if(rate < MAX_RATE) rate++;
else state stopped;
spin(rate);
}
}

This will start spinning slowly and speed up with each touch until it's going 10 cps, then it'll stop.

From: someone
from now anticlockwise to clockwise?
Negative rate.
PetGirl Bergman
Fellow Creature:-)
Join date: 16 Feb 2005
Posts: 2,414
03-26-2006 11:16
Oh tks!!!! AGAIN !!!... and now... WHEN shall I have time to sleeeeppppp?????

*smiles*...

/Tina