Page 1 of 1

llSetLocalRot not assigning values. :)

Posted: Thu Jul 13, 2023 6:01 pm
by Joe Love
I'm bangin my virtual head against the virtual wall on this one. :)

I'm doing a script that just moves a prim from a "stored" position to a "use" position with a click, and click again to move it back to the stored position. Positioning it works fine. The prim also needs to be rotated a bit, which is where the problem is.

Rotating it to the "use" position doesn't do well. It's not applying the right rotation values. I can enter the values in edit object screen, and the prim rotate fine. The second click rotates and postions the prim back to "stored" fine. It's just the "use" rotation that has issues.

Help.. would be greatly appreciated :). THANKS JOE

// script

integer on = TRUE;
vector use = <-5.2565, 0.1382, -1.90>; // use difference from stored position.
rotation userot = <0.0, 90.0, 122.0, 0>; // use rotation values.

vector stored; // gets location of stored prim
rotation storedrot = <0.0, 0.0 , 180, 0>; // stored rotation values.

default
{
state_entry()
{
stored = llGetPos(); // gets the current postion of the prim
}

touch_start(integer x)
{
if (on==TRUE)
{
llSetPos(stored - use); // calculate new position and move to use position
llSetLocalRot (userot); // rotate prim for use. ** <-THIS DOES NOT WORK
on = FALSE;
}
else if (on==FALSE)
{
llSetPos(stored); // move prim back to stored position
llSetLocalRot(storedrot); // rotate it to storedrot. ** <-THIS WORKS
on=TRUE;
}
}

}
// end

Re: llSetLocalRot not assigning values. :)

Posted: Thu Jul 13, 2023 6:38 pm
by Graham Mills
Have you tried llSetRot?

Re: llSetLocalRot not assigning values. :)

Posted: Thu Jul 13, 2023 8:01 pm
by Joe Love
THANKS for the reply. :)

YES..

llSetRot(userot);
&
llSetPrimitiveParams [(PRIM_ROTATION, usedrot)};

it's crazy that ONLY the "storedrot" values work in the script.
"userot" applies different values. :)

Re: llSetLocalRot not assigning values. :)

Posted: Thu Jul 13, 2023 11:51 pm
by Joe Love
found the answer. sharing it .

http://www.lslwiki.digiworldz.com/lslwi ... a=rotation

Degrees need to be converted to radians. this explains it well. :)))