Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Correct movement direction on rez

Mod Faulkner
Registered User
Join date: 11 Oct 2005
Posts: 187
04-10-2006 09:11
I am using llSetPos(llGetLocalPos() + Offset); to open and close a drawer in a desk. (Offset being the distance necessary for move the correct distance which the script reverses to close the drawer). It works fine until I take the desk into my inventory and then rez it again. I tried llResetScript on_rez, and llGetLocalPos() on_rez. but the movement is still reversed and I have to manual move the drawer into the correct position for it to work. Is there a way to assure that the movement will be the same when the desk is taken in and out of my inventory.
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
04-10-2006 09:37
Can you post the whole script? Here are a couple of thoughts off the top of my head...

CODE
llSetPos(llGetLocalPos() + Offset);


Unless Offset takes the object's rotation into account, this will probably also fail if you rotate the desk. You probably need something like:

CODE
llGetLocalPos() + Offset * llGetRot()


Also, I'm not sure how you're keeping track of whether the drawer is open or closed, and if that knowledge is reset on a rez. That could affect it - if the drawer 'thinks' its open, it will move backwards because it's trying to close. But if it's not really in the open position, then the movement will be wrong.
Mod Faulkner
Registered User
Join date: 11 Oct 2005
Posts: 187
Thanks
04-10-2006 11:54
Thanks Zigg, I cannot get to the script where I am now or I would post it. I will try out your suggestons later and get back to you on the results.