Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Sliding Door

Chaz Longstaff
Registered User
Join date: 11 Oct 2006
Posts: 685
09-30-2007 12:17
Though instantly you're going to be tempted to say this has been covered a zillion times, I *have* done the 9 hours of searching, experimenting, searching, experimenting, and I think I'm just being extra dense on this one. Maybe part of the denseness is not asking for advice earlier :}

The challenge I've given myself is to create a 1 prim sliding door linked to an elevator. When opened, it shrinks down to about 1/8th (or something) of its width, and moves off the side.

When closed, it resumes normal size, and moves to cover the whole front of the ely.

At least, that's the goal. Aint' working.

Issues encountered include:
- door leaping off to side of ely, and getting successively further away from it;
- often but not always when door closes, it shrinks down to 1/8th open size, and goes to the middle of the doorway;
etc.

Below are the functions that I use to open and close it with. I've had them lengthier, trying to construct position vectors from scratch etc, but I got the feeling I was making this more complicated than it needed to be and was tripping over myself, and so went back to basics.

And remember, this is linked to an elevator -- which means that the height of where the door is, in relation to ground level, is going to change, so I can't hard code z for instance, *and*, I need to keep it flexible for door opening on x or y axis.

So, sigh, with those added complications... any advice? happy to be called stupid and have it pointed out to me how I missed a simple, reliable solution...

default {

state_entry() {
BasePos = llGetLocalPos();
}

}

fuctions that get called:

doorClose() {
if ( (doorStatus != "Closed";) && (doorStatus != "";) ) {
llSetPrimitiveParams([PRIM_SIZE, <2.958, 0.050, 3.29>,
PRIM_POSITION, BasePos
]);
doorStatus = "Closed";
}
}

doorOpen() {
if (doorStatus != "Opened";) {
llSetPrimitiveParams(
[ PRIM_SIZE, <.5, 0.050, 3.29>,
PRIM_POSITION, llGetLocalPos() + <1.2, 0, 0>
]);
doorStatus = "Opened";
}
}
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
09-30-2007 16:15
Path Cut your door prim so that its pivot lies on one edge, then you can open/close it just by scaling, without needing to move it as well.
Qwerty Writer
Registered User
Join date: 5 Mar 2007
Posts: 5
10-02-2007 06:40
A year has gone and new relaeses followed up (its 1-18-3-5 now) but I have the same problem as Chaz Longstaff now. My elevator has 3 levels to go and consequently there are 3 elevator doors to open and close when the cabin arrives or leaves. All 3 door-scripts are indentical. The door at floor 1 works correct, the door at floor 2 misses 1 step when shinking and as a result of that grows 1 step bigger each time it closes (expands). And the door at floor 3 never shrinks and never expands but it does move without any problems (goto http://slurl.com/secondlife/Ceiernon/250/151/40 if you wanna see the state of the art).

The doors are linked to the building and have the following parameters:

SCALE Local Position
DOOR_1: <2.0, 0.1, 8.0> <3.75, -0.2237, 4.356>
DOOR_2: <2.0, 0.1, 4.0> <3.75, -0.2237, 10.6078>
DOOR_3: <2.0, 0.1, 4.0> <3.75, -0.2237, 14.8578>

To shrink/expand and move the doors i use the following code.

OpenOrCloseSmoothly(string message) // STEPDISTANCE = 0.2
{
vector DoorOffset = <STEPDISTANCE/2, 0.0, 0.0>;
vector DoorScale = llGetScale();
vector DoorHomeLocal = llGetLocalPos();
integer i;
if (message == "open";)
{
for (i = 0; i <= 8; ++i)
{
llSetScale(DoorScale - i * <STEPDISTANCE, 0.0, 0.0>;);
llSetPos(DoorHomeLocal + i * DoorOffset);
}
}
else if (message == "close";)
{
for (i = 0; i <= 8; ++i)
{
llSetScale(DoorScale + i * <STEPDISTANCE, 0.0, 0.0>;);
llSetPos(DoorHomeLocal - i * DoorOffset);
}
}
else llOwnerSay("DOOR_1: ERROR -> message = " + message); // Never happens.
}

My questions:

1) Is scaling linked objects not possible above some height?
2) Is this a well know problem or bug and shout it be documented at Function: llSetScale( vector scale ) ?
3) Is there a work around available?

Unfortunately I do not understand the solution of Deanna Trollop. Some more explanation and any suggestions for Path Cut B and E values to fix a pivot left or right would be appreciated.

Regards,
QW
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
10-02-2007 07:23
From: Qwerty Writer
Unfortunately I do not understand the solution of Deanna Trollop. Some more explanation and any suggestions for Path Cut B and E values to fix a pivot left or right would be appreciated.
B:0.125, E:0.625 will cut the prim in half along its local X axis (leaving the positive-X side).
B:0.375, E:0.875 does the same, but for the Y axis.
Chaz Longstaff
Registered User
Join date: 11 Oct 2006
Posts: 685
10-02-2007 07:31
From: Deanna Trollop
B:0.125, E:0.625 will cut the prim in half along its local X axis (leaving the positive-X side).
B:0.375, E:0.875 does the same, but for the Y axis.


Sorry for taking so long to get back, Deanna. My VKC dog got herself lost. I eventually found her under the floorboards.

I tried the path cut. It seemed sadly to wreak havoc with the application of textures on at least one side, and not seem promising for easily switching from x to y axis, but the texture oddness was a show-stopper so I didn't go any further, and am continuing with a scripty approach instead.
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
10-02-2007 08:43
From: Chaz Longstaff
It seemed sadly to wreak havoc with the application of textures on at least one side
The faces parallel to the cut axis will only be "half" faces, so if, for example, you want a texture to exactly fill the face, it would need H repeats at 2 and an H offset of 0.5.

From: someone
and not seem promising for easily switching from x to y axis,
There should be no need to "switch" axes, if I'm understanding the application correctly. If you cut the prim along the X-axis, then you only need to scale it along the X-axis to open and close the door, with no movement relative to the rest of the elevator car necessary.
Billy Islander
Registered User
Join date: 3 Nov 2006
Posts: 35
11-12-2007 10:31
you could try putting this code in , it will hollow out the door so you walk straight it
Hope this helps

[PHP
integer open = TRUE;
integer steps = 10;


default
{
state_entry()
{

}

touch_start(integer total_number)
{
if (open == TRUE)


{

llSetPrimitiveParams([PRIM_TYPE,
PRIM_TYPE_BOX,
0, // hole_shape
<0.0, 1.0, 0.0>, // cut
0.0, // hollow
<0.0, 0.0, 0.0>, // twist
<1.0, 1.0, 0.0>, // taper
<0.0, 0.0, 0.0> // top_Shear
]);


llSay(0, "Door Closed";);
open = FALSE;
}
else if (open == FALSE)
{
integer i;
for(i=0;i<steps;i++)
{

llSetPrimitiveParams([PRIM_TYPE,
PRIM_TYPE_BOX,
0, // hole_shape
<0.0, 1.0, 0.0>, // cut
(float)(i)/(float)steps, // hollow
<0.0, 0.0, 0.0>, // twist
<1.0,1.0, 0.0>, // taper
<0.0, 0.0, 0.0> // top_Shear
]);

}

llSay(0, "Door Open";);
open = TRUE;
}
}

}
CODE
Nyoko Salome
kittytailmeowmeow
Join date: 18 Jul 2005
Posts: 1,378
11-12-2007 13:37
i think there are ongoing competing bugs depending if you are using individual llSetRot/llSetPos calls vs. llSetPrimParams... i'm not fresh on all of them though.

my current experiment finds that you may need to do a llSetPos for an llSetRot to set correctly. but it's a bit weird and random right now...

p.s. check jira:)) i hardly ever get there myself, but...
_____________________

Nyoko's Bodyoils @ Nyoko's Wears
http://slurl.com/secondlife/Centaur/126/251/734/
http://home.comcast.net/~nyoko.salome2/nyokosWears/index.html

"i don't spend nearly enough time on the holodeck. i should go there more often and relax." - deanna troi
Teddy Qinan
Registered User
Join date: 10 Mar 2007
Posts: 34
11-12-2007 20:15
I haven't tested this in game but try....

The BasePos is saved each time the door is opened to account for changes in the z axis at different floors.

vector BasePos;

doorClose() {
if ( (doorStatus != "Closed";) && (doorStatus != "";) ) {
llSetPrimitiveParams([PRIM_SIZE, <2.958, 0.050, 3.29>,
PRIM_POSITION, BasePos
]);
doorStatus = "Closed";
}
}

doorOpen() {
if (doorStatus != "Opened";) {
BasePos = llGetPos(); //No need for llGetLocalPos on a linked prim
llSetPrimitiveParams(
[ PRIM_SIZE, <.5, 0.050, 3.29>,
PRIM_POSITION, BasePos + <1.2, 0, 0>
]);
doorStatus = "Opened";
}
}
Qwerty Writer
Registered User
Join date: 5 Mar 2007
Posts: 5
Release 1.19.1.4 solved my problems with door 2 and 3
04-04-2008 05:11
Another year has gone and guess what happened now? Without any changes all 3 elevator doors work correctly since i installed the new SL release 1.19.1.4 today. Linden Lab, thank you so much for solving this problem.
QW


From: Qwerty Writer
A year has gone and new relaeses followed up (its 1-18-3-5 now) but I have the same problem as Chaz Longstaff now. My elevator has 3 levels to go and consequently there are 3 elevator doors to open and close when the cabin arrives or leaves. All 3 door-scripts are indentical. The door at floor 1 works correct, the door at floor 2 misses 1 step when shinking and as a result of that grows 1 step bigger each time it closes (expands). And the door at floor 3 never shrinks and never expands but it does move without any problems (goto http://slurl.com/secondlife/Ceiernon/250/151/40 if you wanna see the state of the art).

The doors are linked to the building and have the following parameters:

SCALE Local Position
DOOR_1: <2.0, 0.1, 8.0> <3.75, -0.2237, 4.356>
DOOR_2: <2.0, 0.1, 4.0> <3.75, -0.2237, 10.6078>
DOOR_3: <2.0, 0.1, 4.0> <3.75, -0.2237, 14.8578>

To shrink/expand and move the doors i use the following code.

OpenOrCloseSmoothly(string message) // STEPDISTANCE = 0.2
{
vector DoorOffset = <STEPDISTANCE/2, 0.0, 0.0>;
vector DoorScale = llGetScale();
vector DoorHomeLocal = llGetLocalPos();
integer i;
if (message == "open";)
{
for (i = 0; i <= 8; ++i)
{
llSetScale(DoorScale - i * <STEPDISTANCE, 0.0, 0.0>;);
llSetPos(DoorHomeLocal + i * DoorOffset);
}
}
else if (message == "close";)
{
for (i = 0; i <= 8; ++i)
{
llSetScale(DoorScale + i * <STEPDISTANCE, 0.0, 0.0>;);
llSetPos(DoorHomeLocal - i * DoorOffset);
}
}
else llOwnerSay("DOOR_1: ERROR -> message = " + message); // Never happens.
}

My questions:

1) Is scaling linked objects not possible above some height?
2) Is this a well know problem or bug and shout it be documented at Function: llSetScale( vector scale ) ?
3) Is there a work around available?

Unfortunately I do not understand the solution of Deanna Trollop. Some more explanation and any suggestions for Path Cut B and E values to fix a pivot left or right would be appreciated.

Regards,
QW