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
llSetLocalRot not assigning values. :)
llSetLocalRot not assigning values. :)
- These users thanked the author Joe Love for the post:
- Ilan Tochner
-
- Posts: 1314
- Joined: Sun Dec 23, 2012 2:26 pm
- Has thanked: 1134 times
- Been thanked: 1142 times
Re: llSetLocalRot not assigning values. :)
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.
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. :)
found the answer. sharing it .
http://www.lslwiki.digiworldz.com/lslwi ... a=rotation
Degrees need to be converted to radians. this explains it well. ))
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 Tochner • Graham Mills