Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Activate/Deactivate Rotate on Touch?

Alida Tomsen
Registered User
Join date: 14 Mar 2007
Posts: 82
09-08-2007 20:38
I thought I had it, but I don't... I'm not a scripter, but a builder - and I can't figure out, for the life of me, how to make something rotate and then stop on touch.

Help?
_____________________
"I have been nothing, but there is always tomorrow."

Jubal Sackett
Haruki Watanabe
llSLCrash(void);
Join date: 28 Mar 2007
Posts: 434
09-09-2007 01:18
llTargetOmega is your friend :)

llTargetOmega(vector axis, float spinrate, float gain)

use something like this:

CODE


integer rotating;

default{

state_entry()
{
rotating = FALSE; // initialize the rotating status
}

touch_start(integer total_number)
{
if(rotating == FALSE)
{
// start the rotation (in this example around z-axis)

llTargetOmega(<0,0,1>, 1.0, 1.0);

}
else
{
// stop the rotation
llTargetOmega(<0,0,0>, 0, 0);

}
}

}



HTH
Alida Tomsen
Registered User
Join date: 14 Mar 2007
Posts: 82
09-09-2007 01:49
Bless you! That starts it great! now to get it to stop :)
_____________________
"I have been nothing, but there is always tomorrow."

Jubal Sackett
Bloodsong Termagant
Manic Artist
Join date: 22 Jan 2007
Posts: 615
09-10-2007 08:00
heyas;

stopping target omega is bugged. still. it's in the jira, and supposedly they're working on it....

in the meantime, i hope stopping the rotation wasn't mission critical for you :/ if it is, you might want to look into rotating your object with actual rotations. it's not as easy, and i think it turns out a bit choppy, but i've seen it done. there's a sewer rattie that uses it, and barney boomslang's tiny dirigible uses it on the propeller. (those are both freebies you can look at.)
_____________________
Why Johnny Can't Rotate:
http://forums.secondlife.com/showthread.php?t=94705
Nika Talaj
now you see her ...
Join date: 2 Jan 2007
Posts: 5,449
09-10-2007 09:43
According to the bug descriptions (the active bug on this is SVC-54, a slightly more detailed description is in the dupe MISC-199), llTargetOmego should work fine if in an unlinked or root prim.

"llTargetOmega(<0.0, 0.0, 0.0>, 0.0, 0.0);
only works when this line is written (or a pre-written script is dropped) in an unlinked or root prim. if placed in a linked child prim, it fails to stop any previous TargetOmega rotations. if the script is written/dropped in an unlinked prim, which is linked AFTERWARDS, it works fine. it also works fine in unliked or linked root prims"

Not true? I'm not inworld to try ...
Shyan Graves
Registered User
Join date: 10 Feb 2007
Posts: 52
09-10-2007 10:22
Hi,

Haruki's script should do the trick but ther is a small error in it, you never get to the else branch, cuz rotating is not set to anything else than FALSE!


From: Haruki Watanabe
llTargetOmega is your friend :)

llTargetOmega(vector axis, float spinrate, float gain)

use something like this:

CODE


integer rotating;

default{

state_entry()
{
rotating = FALSE; // initialize the rotating status
}

touch_start(integer total_number)
{
if(rotating == FALSE)
{
// start the rotation (in this example around z-axis)

llTargetOmega(<0,0,1>, 1.0, 1.0);

}
else
{
// stop the rotation
llTargetOmega(<0,0,0>, 0, 0);

}
}

}



HTH


change it to:

CODE


integer rotating;

default{

state_entry()
{
rotating = FALSE; // initialize the rotating status
}

touch_start(integer total_number)
{
if(rotating == FALSE)
{
// start the rotation (in this example around z-axis)
llTargetOmega(<0,0,1>, 1.0, 1.0);
rotating = TRUE;
}
else
{
// stop the rotation
llTargetOmega(<0,0,0>, 0, 0);
rotating = FALSE;
}

}

}



That works definately for me if I put the script in a root prim!