Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llTargetOmega script?

Tai Clifford
Registered User
Join date: 26 Jul 2006
Posts: 45
09-24-2006 18:20
I have a script that will rotate a child prim when touched, then stops. rotates back the other way when touched again and then stops. I am using "llTargetOmega(<1,0,0>, 2.0, 1.0);" to start the rotation and then "llTargetOmega(<1,0,0>, 0.0, 0.0);" to stop it. Works fine when I install the script and save it. But if I take the object and rez it again the rotation doesn't work anymore. I have to resave the script to get it to work. Any ideas why I am having this problem? I need this script to work on a newly rezzed object.
Takuan Daikon
choppy choppy!
Join date: 22 Jun 2006
Posts: 305
09-24-2006 18:29
Consider yourself lucky it works the first time. Since the last update I cannot see rotation with any object that uses llTargetOmega() at all. Friends see the rotation, I do not. llTargetOmega() seems to have been borked good in all kinds of ways....
Lazink Maeterlinck
Registered User
Join date: 8 Nov 2005
Posts: 332
09-24-2006 18:37
yes, add

CODE

on_rez(integer start_param)
{
llTargetOmega(<1, 0, 0>, 2.0, 1.0);
}



to your code. This will tell it when rezzed to start the spin. Right now in just state_entry it does work because the script does not enter that event when you rez somehting. Or use llResetScript() in the on_rez event as well.
Tai Clifford
Registered User
Join date: 26 Jul 2006
Posts: 45
09-25-2006 14:15
From: Lazink Maeterlinck
yes, add

CODE

on_rez(integer start_param)
{
llTargetOmega(<1, 0, 0>, 2.0, 1.0);
}



to your code. This will tell it when rezzed to start the spin. Right now in just state_entry it does work because the script does not enter that event when you rez somehting. Or use llResetScript() in the on_rez event as well.

Thanks for the tip. It seems to work OK, most of the time now. A bit intermittent.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
09-25-2006 14:40
I'm certain it is a bug. I have an attachment that picks a new random axis for 'llTargetOmega()' every 2 seconds. Or it is supposed to anyway. At times it gets stuck not rotating at all and I have to edit the object and then exit edit mode to get it to rotate. And it ALWAYS gets stuck on one fixed rotation after a short period. I think this might be after it is newly attached (from wear or login/TP; whatever). The only dependable way to get it to start switching again is to edit the script, change it, and re-save. Resetting the script does NOT always work. I've been meaning to Bug Report this for a while. I'm doing it now.

Here is the script:
CODE
float TIMER_PERIOD = 2.0;
float ANGULAR_SPEED = 6.0;

changeRotation()
{
float xComp = llFrand(1.0);
float yComp = llFrand(1.0);
float zComp = llFrand(1.0);

vector dir = llVecNorm(<xComp, yComp, zComp>);

llTargetOmega(dir, ANGULAR_SPEED, 0.1);

// Note: Uncomment this line and you will see output even though the axis stops changing.
//llOwnerSay("DEBUG - Changing spin axis.");
}

default
{
state_entry()
{
changeRotation();
llSetTimerEvent(2.0);
}

timer()
{
changeRotation();
}
}