Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llTargetOmega problem or bug?

Ludovico Dover
Registered User
Join date: 1 Dec 2008
Posts: 11
12-05-2008 08:19
Hi! I'm not sure if it's a real scripting problem or if it's a bug...
I have two linked prims, 1 root (the button) an 1 child (a bar). When you push the button, bar start rotating. Push it again and it stops. Everithing works fine, only when it stops the bar, after stopping correctly, slightly adjust its position (rotation?).
Is it normal?

Thanks!

below the prim code (button):

CODE

integer hasMoved = FALSE;
// Commands
integer START = 1;
integer STOP = 2;
default
{
touch_start(integer count)
{
if (hasMoved)
{
// Tell the other prim to stop rotating.
llSetText("Touch me to stop", <0,0,1>, 1.5);
llMessageLinked(LINK_SET, START, "", NULL_KEY);
hasMoved = FALSE;
}
else
{
// Tell the other prim to start rotating.
llSetText("Touch me to start", <0,0,1>, 1.5);
llMessageLinked(LINK_SET, STOP, "", NULL_KEY);
hasMoved = TRUE;
}
}
}


And the child prim (bar):

CODE

// Commands
integer START = 1;
integer STOP = 2;
rotation rot;
default
{
state_entry()
{
// Make sure we're not spinning.
rot = llGetRot();

}
link_message(integer sender, integer num, string params, key id)
{
// Check that this came from the main script.
if (sender == 1)
{
// Find out which command was received
if (num == START)
{
{
llSetText("I'm rotating!", <0,1,0>, 1.5);
llTargetOmega(<0,1,0>,PI/2,1.0);
}
}
else if (num == STOP)
{
llSetText("Stopped",<1,0,0>, 1.5);
llTargetOmega(ZERO_VECTOR,1.0,1.0);
llSleep ( 2 ); //to remove text from prim
llSetText("", <1,1,1>, 1.5);
}
}
}
}
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
12-05-2008 10:29
Well, note that llTargetOmega() in a child prim (just like for non-physical objects in the root prim) doesn't actually rotate the prim on the server; it just affects how viewers render the prim from moment to moment. So when you turn off llTargetOmega() the prim might jump back to its true, original orientation. I think they've changed how this works once or twice. Sometimes it might not happen until after you force another update to be sent to viewers (like where you clear the prim's floating text after your two-second sleep there).