I've made a sculpty prim necklace with one layer of prims sitting on top of another. I just want the *top* layer of prims to move either outwards or inwards along the x-axis in very small increments...(the wearer has the option to move these prims either way which creates the effect of a different design when the top prims move over top the bottom ones.)
The root prim is invisible and centered in the middle of the avi's neck. To widen the top layer of the necklace I want the child prims on the avi's right to move right along x, and the prims on the left side going left on x. The wearer can also move the prims back in again along x to narrow the top layer, as narrow as they want to go.
First I tried just using llSetPos to reposition the child prims. In the root prim to narrow the necklace by 1% I have
llMessageLinked(LINK_SET, 1999, "0.99", NULL_KEY);
and to widen it 1%
llMessageLinked(LINK_SET, 1999, "1.01", NULL_KEY);
Then in the Child prims to be repositioned:
CODE
default
{
link_message(integer sender_num, integer num, string str, key id)
{
if (num == 1999)
{
float position = (float)str;
vector currentposition = llGetLocalPos();
vector newposition = currentposition * position;
if (llGetLinkNumber() > 1) // only move if not the root object
{
llSetPos(<newposition.x,0,0>); // reposition
}
}
}
}
But this initially displaced the prims away from the necklace and after that only the right prims moved.
2nd Attempt:
I then tried using llSetPrimitiveParams instead of llSetPos.
CODE
default
{
link_message(integer sender_num, integer num, string str, key id)
{
if (num == 1999)
{
float position = (float)str;
vector currentposition = llGetPos();
vector newposition = currentposition * position;
list primparams = [];
primparams += [PRIM_POSITION, newposition]; // reposition
if (llGetLinkNumber() > 1)
{
primparams += [PRIM_POSITION, llGetLocalPos() * position]; // reposition
}
llSetPrimitiveParams(primparams);
}
}
}
This came the closest to working - the child prims on the right side widened and narrowed seemingly along x axis like I wanted (I *think*, but I don't know how to target just x coordinate using llSetPrimitiveParams), but the child prims on the left moved in and out on a 45 degree angle relative to the root prim.
Help?

