Door size resets to 2x4
If you change the size you will need to change the script - the script controls the size.
If you change the line:
vector POSITION_SMALL = <0.0, 0.0, 3.95>; // Offset for 0.1m size
to
vector POSITION_SMALL = <0.0, 0.0, 0.05>; // Offset for 0.1m size
you will get a Bottom-Up version of the door.
Playing with this line you can also create a Side Opening door. Experiment! If it messes up, copy-paste the full script back into the Script in Prim Contents and start again.
The Full Script :
// PRIM RESIZE Script
float HEIGHT_SMALL = 0.1;
float HEIGHT_LARGE = 4.0;
vector SIZE = <2.0, 0.1, 0.0>; // X and Y are fixed, Z will change
vector POSITION_SMALL = <0.0, 0.0, 3.95>; // Offset for 0.1m size
vector POSITION_LARGE = <0.0, 0.0, 2.0>; // Offset for 4m size
default
{
touch_start(integer total_number)
{
vector basePos = llGetPos(); // Establish base position at every click
vector currentSize = llGetScale();
vector newSize;
vector newPosition;
if (currentSize.z == HEIGHT_LARGE)
{
newSize = <SIZE.x, SIZE.y, HEIGHT_SMALL>;
newPosition = basePos + POSITION_SMALL - POSITION_LARGE; // Adjust relative to current position
}
else
{
newSize = <SIZE.x, SIZE.y, HEIGHT_LARGE>;
newPosition = basePos + POSITION_LARGE - POSITION_SMALL; // Adjust relative to current position
}
llSetScale(newSize);
llSetPos(newPosition);
}
}