Sliding door dealing with world rotation and also linked as child.
|
|
Mason Kingsford
Registered User
Join date: 12 Nov 2006
Posts: 42
|
04-13-2007 14:59
Hey hi,
I have a lockable sliding door script that I made a while back, easy enough. However, I'm packaging it up with my house, and I realize that rotating the house will cause the sliding door to open incorrectly. It's obvious why this is happening. Using the llSetPos with a vector, it's telling the door to move in only that direction.
So, I've looked for some info on this, but I can't quite find the answer. How could I script it so that it knows the right direction to move no matter the orientation of the building?
Would having it linked as a child to a wall fix the problem? And if so, what's the trick to getting the child object to respond when clicked? Would I need a script in the wall that talked to the child door? Would that then make the whole wall clickable?
Any tips or pointers in the right direction here would be appreciated.
Many thanks, Mason
|
|
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
|
04-13-2007 15:32
Check out the Timeless Prototype door script: http://lsl.dimentox.com/snippet.php?sid=7It records the open and close positions wrt root prim and has lots of features. Can be either a swing or sliding door (or drawer with some adaptation) as it adjusts size, position and rotation.
|
|
Mason Kingsford
Registered User
Join date: 12 Nov 2006
Posts: 42
|
04-13-2007 16:34
From: ed44 Gupte Check out the Timeless Prototype door script: http://lsl.dimentox.com/snippet.php?sid=7It records the open and close positions wrt root prim and has lots of features. Can be either a swing or sliding door (or drawer with some adaptation) as it adjusts size, position and rotation. ed44, Thanks, I appreciate the reply. I did see that script earlier. I'm pretty happy with my script, and it's features, so I was mostly looking for a tip to help me finish it off. I played around a little more, and i was able to link it as a child and get it to work by simply changing my llGetPos to llGetLocalPos. This allows me to move the parent where ever I want and the door still works correctly. The only problem now is that the door handle no longer follows the door object! I guess I'll have to write a script for the door handle too. Thanks again...
|
|
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
|
04-13-2007 19:42
Yes...for door scripts the best idea is:
llSetLocalPos();
If you're door is 'multi-prim' (ie, includes a handle)...make the prim holding the doors script the root prim in your link set and do NOT attach it to your building.
If your door is 'single-prim', link the door as a child prim to the rest of your build.
_____________________
--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.
|
|
Mason Kingsford
Registered User
Join date: 12 Nov 2006
Posts: 42
|
04-13-2007 22:42
From: Kenn Nilsson Yes...for door scripts the best idea is:
llSetLocalPos();
If you're door is 'multi-prim' (ie, includes a handle)...make the prim holding the doors script the root prim in your link set and do NOT attach it to your building.
If your door is 'single-prim', link the door as a child prim to the rest of your build. Kenn, Hi, thanks for your reply. Problem is that my door is double prim with it's handle AND I need to link it to the wall so that when the building is rezzed and rotated, the door will still slide properly. So... just need to figure the best way to get the handle to move with the door. My current idea is to use a llMessageLinked and have a script in the handle that will move it when the door moves. If you or anyone has a better idea, please chime in!
|
|
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
|
04-14-2007 16:48
The difficulty you're going to run into is that the door-handle will have a different rotational axis than your main door (of course, if your door is sliding, you have no problems...as each piece needs only move the same distance in a straight line). The result will probably be that your door swings fine...and your handle swings fine...but they separate while swinging open and your handle ends up floating in mid-air--however, with a correct rotation.
The solution is, of course, to couple the rotation with an llSetPos(); It just seems an awful headache when there are rezzers out there that will help place multi-object buildings for customers and eliminate the need for a single-object build.
_____________________
--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.
|
|
Mason Kingsford
Registered User
Join date: 12 Nov 2006
Posts: 42
|
04-15-2007 16:30
From: Kenn Nilsson The difficulty you're going to run into is that the door-handle will have a different rotational axis than your main door (of course, if your door is sliding, you have no problems...as each piece needs only move the same distance in a straight line). The result will probably be that your door swings fine...and your handle swings fine...but they separate while swinging open and your handle ends up floating in mid-air--however, with a correct rotation.
The solution is, of course, to couple the rotation with an llSetPos(); It just seems an awful headache when there are rezzers out there that will help place multi-object buildings for customers and eliminate the need for a single-object build. Not sure about rotating doors, but with sliding doors, if they are not linked, and then rezzed into a different rotation, then they will not slide properly. They have to be linked to a wall or something, then when rezzed at a funky angle, the slide will still work just right. The handle might have a delay in a high lag situation, but so far tests prove that the llLinkedMessage is effective. As long as I send the linked message to the handle BEFORE I set the position of the open door, it's good. I'm sure when i tackle the rotating doors later on, that I'll have different problems to resolve.
|
|
Ace Albion
Registered User
Join date: 21 Oct 2005
Posts: 866
|
04-16-2007 01:24
From: Mason Kingsford Kenn,
Hi, thanks for your reply. Problem is that my door is double prim with it's handle AND I need to link it to the wall so that when the building is rezzed and rotated, the door will still slide properly. So... just need to figure the best way to get the handle to move with the door. My current idea is to use a llMessageLinked and have a script in the handle that will move it when the door moves. If you or anyone has a better idea, please chime in! That sounds good. I'd maybe pass an integer with the message and have (either from prim description, notecard, or entered into the scripts) pairs of numbers. So when door "1" slides, if handle "1" gets the message sent to the linkset it will move, then door "2" with handle "2", etc. You could do it with sending messages only to specific link number prims, but that won't survive any relinking or editing I think. It's possible to make a multiprim swing door linked in too, just the position of the handle needs a bit of maths, and with the lag in SL, it might not be reliable. I like to ponder the possibilities, then go back to single prim simple doors 
_____________________
Ace's Spaces! at Deco (147, 148, 24) ace.5pointstudio.com
|