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