mkay I think I see the issue, and a novel way to solve it... mostly.
we'll take the case of a sliding glass door, with with two glass panes that each cover 50% of the frame. on will move, the other will not if I understand correctly you want to a) resize/move the frame and have that information passed to the glass panes, so that they resize/move to match, and b) have that information update to allow the panes to move the correct amount in relation to the frame.
for this example, the frame may be rotated to to any odd angle, and may or may not be linked to a larger structure.
as a build trick, the moving glass pane will be aligned to the exact same rotation as the frame. in our case we'll use a hollowed cube, and the moving pane will be flattened along the z axis, and will cover half of the x axis on the -x side at closed.
from the frame prim we already know what the glass prims rotation should be (they match) and we can tell what the size should be (because it will be a percentage of our frame size), and it's position (because it'll be relative to our center, minus half the moving panes size)
we also know that the open position will be that same percentage, but plus the offset from our frame center on the x axis.
since we can calculate all the information for the pane, from the frame, we only need to get information for the frame... in this case, size, position, and rotation.
llGetScale will tell us our size linked or not
llGetLocalPos will get our position... either relative to the root, if linked, or region if not (just for safety)
llGetLocalRot will get our rotation, again safely relative to region or root.
the reasoning for getting pos/rot relative to the nearest frame of reference is to only have to deal with one level of coordinate frames, instead of two possible ones which would have to be handled differently. in this case it will treat root local frame as being the same as region local. (if I didn't make sense, just go with it, it works)
for the frame assume a hollow of 90% and a prim size of x=2m, y=1m, (z doesn't really matter, it'll probably be small)
gBooOpen = FALSE;
frameRot = llGetLocalRot();
frameSize = llGetScale();
framePos = llGetLocalPos();
paneRot = frameRot;
paneSize = frameSize * 0.9;
panePosLocal = < 0.5 * paneSize, 0.0, 0.0 > * frameRot;
gBooOpen = !gBooOpen;
panePosLocalNext = panePosLocal * (-gBooOpen | 1); //trick to get -1 or +1 from a boolean switch
PanePosRelativeNext = framePos - panePosLocalNext;
llSetLinkPrimitiveParams(
paneLinkNumber,
[PRIM_ROTATION, paneRot,
PRIM_SCALE, paneSize,
PRIM_POSITION, PanePosRelativeNext] );
or all together...
llSetLinkPrimitiveParams(
paneLinkNumber,
[PRIM_ROTATION, llGetLocalRot(),
PRIM_SCALE, llGetScale() * 0.9,
PRIM_POSITION, llGetLocalPos() -
(< 0.5 * llGetScale() * 0.9, 0.0, 0.0 > * llGetLocalRot()) *
(-(gBooOpen = !gBooOpen) | 1)] );
as for why the muliplication by the rotation is needed? it takes the region direction of the offset, and rotates it to match the local facing of the prim. if you take a plain cube, and rotate it 90deg clockwise from the top, it's +x axis now faces south. if you want a point that's 1m forward from that face, you take < 1, 0, 0 > which would be 1m +x when it's not rotated, and multiply it by the current rotation to swing that point around, and then add it to the position of the prim and you'll find the position is 1m south, but perfectly 1m along the prims +x axis.