Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Sliding Doors--Stumped Myself

Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
12-15-2005 22:21
Alright...so the question is easy, but the answer has me reeling...

...I have a door that, when the option to become a sliding door is selected, will dynamically determine it's current position (easy...startpos = llGetPos())...

...and then determine its slide-to position (endpos) at two meters off from either the x or y axis (depending on the doors current rotation)...

...so yea...I've been playin' with getting the door's current rotation and then setting the endpos vector on an if(rot = <x,y,z,s>;)...but the if-statements never seem to qualify, even when I copy-paste the exact rotation from an "llSay(0, llGetRot())".

...So...question is...

...if you were to script a door that needed to determine which way it was sliding and what its end position was going to be dynamically and without help...how would you do it?
_____________________
--AeonVox--

Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.
Lightwave Valkyrie
Registered User
Join date: 30 Jan 2004
Posts: 666
12-15-2005 22:41
im not sure i understand the question but...
i would slide the door localy, um
link the door to a root invisable prim
then llGetLocalPos of the door open and
closed relative to the root prim and use
llSetpos to open and close localy it wont
matter how the root prim is rotated.
-LW
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
12-15-2005 22:57
Thanks Lightwave...I think that might work. I'll give it a try.
_____________________
--AeonVox--

Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.
Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
12-15-2005 23:00
From: Lightwave Valkyrie
im not sure i understand the question but...
i would slide the door localy, um
link the door to a root invisable prim
then llGetLocalPos of the door open and
closed relative to the root prim and use
llSetpos to open and close localy it wont
matter how the root prim is rotated.
-LW


This is the way I would go about the task, as you don't need to worry about asking "where am I?" and "how am I rotated?" the door will be displaced relative to the root prim's position and location using llSetPos. the root could be a frame for the door conveniently enough, or even a control panel for the door if you plan on incorperating other functions into it.
_____________________
My SLExchange shop

Typos are forgiven; desecrating the english language with reckless abandon and necrophilic acts is not.


The function is working perfectly fine. It's just not working the way you wanted it to work.
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
12-16-2005 04:24
If you don't want to use multiple prims then this should do what you want:

CODE
llSetPos(llGetLocalPos() + (offsetVector * llGetLocalRot()));


Call this once to move the object, then call it again with a negative instead of a plus (or with 'offsetVector' set to negative) to put it back again.
offsetVector is just that, a vector telling the door how to move. e.g <-3,0,0> tells it to move 3 metres to it's left. You can make your door move forward/back or even up/down (using the z co-ordinate) for cool effects like a moving wall revealing a hidden corridor, or a portculis for your castle.

This method will cause your door to 'slide' regardless of it's rotation (flip it all over the place, it still works!) and requires only a single prim.
Lightwave Valkyrie
Registered User
Join date: 30 Jan 2004
Posts: 666
12-16-2005 10:20
wow very cool !
this should work with offsetRotations too?
and even linked childprims?
-LW
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
12-16-2005 11:55
Thanks Haravikk...you're a genius.
_____________________
--AeonVox--

Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.