llSetLocalRot not assigning values. :)

Creating scripts
Post Reply
Joe Love
Posts: 10
Joined: Tue May 05, 2015 6:53 pm
Has thanked: 0
Been thanked: 8 times

llSetLocalRot not assigning values. :)

Post 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
These users thanked the author Joe Love for the post:
Ilan Tochner
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1142 times

Re: llSetLocalRot not assigning values. :)

Post by Graham Mills »

Have you tried llSetRot?
Joe Love
Posts: 10
Joined: Tue May 05, 2015 6:53 pm
Has thanked: 0
Been thanked: 8 times

Re: llSetLocalRot not assigning values. :)

Post 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. :)
Joe Love
Posts: 10
Joined: Tue May 05, 2015 6:53 pm
Has thanked: 0
Been thanked: 8 times

Re: llSetLocalRot not assigning values. :)

Post 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. :)))
These users thanked the author Joe Love for the post (total 2):
Ilan TochnerGraham Mills
Post Reply