Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Totally lost on SetPos and SetRot Help Please

Darkness Anubis
Registered User
Join date: 14 Jun 2004
Posts: 1,628
12-12-2007 07:55
I realise there is probably a script I can buy that does this. But I really want to understand how it works as I can see applications far beyond my immediate need.

What I am trying to do is create a sliding door that is rezzed with the house in its correct closed position. (got that much done).

Then I need the door to automatically figure out what its open position should be regardless of the rotation the buyer puts on the house (and thereby the door). Call this final destinatination.

Once I have the final destination I know how to move it. Problem is I am finding myself totally clueless how to get the final destination.

Any help at all would be very much appreciated.

FYI its been almost 25 years since pre cal and my vector math is seriously in bad shape :P
_____________________
Cherry Hotaling
Registered User
Join date: 25 Feb 2007
Posts: 86
12-12-2007 08:07
Hello,

Go here:
http://www.lslwiki.net/lslwiki/wakka.php?wakka=llSetPos

and look under Child Prims.

My suggestion is (For a sliding door you make the door a child prim)

The child prim is allways relative to the parent for movement so it should be much easier as you dont need to run a llGetPosition command.

-Cherry Hotaling
Darkness Anubis
Registered User
Join date: 14 Jun 2004
Posts: 1,628
12-12-2007 08:27
From: Cherry Hotaling
Hello,

Go here:
http://www.lslwiki.net/lslwiki/wakka.php?wakka=llSetPos

and look under Child Prims.

My suggestion is (For a sliding door you make the door a child prim)

The child prim is allways relative to the parent for movement so it should be much easier as you dont need to run a llGetPosition command.

-Cherry Hotaling


ok I read it and I am just as cunfused as before. Near as I can tell I still need to figure out where it moves TO. And that is what I dont know how to figure as if the object s rotated. the X and Y offsets will be different depending on the rotation. ie 0 rotation might have an offset only in Y, but 90 rotation would have offset only in X, and there is always the possibility that the owner of the house did not pick nice numbers for rotation like O and 90.
_____________________
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-12-2007 10:06
have the door check where it's at and what it's rotation is before it moves, so it knows it's current position, then calculat the new position by multipling the offset by it rotation, and adding it to it's current position

llGetPos() + offset * llGetLocalRot();

or you can cheat:

cut a cube prim using the following,
cut begin .125 end .625

rotate it into place with the cut side against the door frame, record the width and axis of the cut (it will be twice your doorway width), record all other dimensions too

inside of that cut prim call
llSetScale( <insert recorde scale numbers, replacing the width axis with .1 ); to open
and
llSetScale( <insert recorde scale numbers>; to close

you can flip states, or use a boolean that you switch each time to control the touch.

a very similar script is here:
https://wiki.secondlife.com/wiki/LlSetScale
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Darkness Anubis
Registered User
Join date: 14 Jun 2004
Posts: 1,628
12-12-2007 10:32
Void you are Brilliant!!!!!!

llGetPos() + offset * llGetLocalRot();

this was the piece of the puzzle I was missing

Its working perfectly now. :D
_____________________
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-12-2007 19:39
From: Darkness Anubis
Void you are Brilliant!!!!!!

llGetPos() + offset * llGetLocalRot();

this was the piece of the puzzle I was missing

Its working perfectly now. :D

not brilliant, IIRC I got that piece from the wiki, it's the same one you use for rezzors


now this...
llSetPos( llGetPos() + (offset - offset * ArcRotatation) * llGetRot() );
llSetRot( ArcRotation * llGetRot() );

is brilliant (it's the formula for obiting a prim around an abitrary offset, in arc sized steps)
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -