Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Problems with llSetPos

Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
05-14-2007 07:17
I am trying to raise the roof of my house on command.

Each of the roof child prims contain a script. The function that makes the move is:
roof_move_to(vector position) {
vector last;
if (position != ZERO_VECTOR)
{
do {
last = llGetPos();
llSetPos(position);
} while ((llVecDist(llGetPos(),position) > 0.001) && (llGetPos() != last));
}
}

This is triggered by a link_message in each roof prim. The message is sent via a llMessageLinked(LINK_SET, 0, msg, NULL_KEY); in the parent prim (one of the walls). The script works as expected if the link set consists only of the roof prims and the parent prim.

However, as I start adding the rest of the house to the set, the script begins failing. Adding in just one or two other parts makes only some of the roof prims raise. Finally, nothing works as I add in more prims. I am always careful to keep the parent prim constant as I add in other prim.

What do you think would be causing the script to fail? Any ideas on a work around?
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
05-14-2007 08:53
If the roof is one linked objects, using llSetPos() in the root prim will move the entire link set the same distance.

llSetPos() in child prims only sets the position as a relative offset from the root prim; i.e., a local position. So, don't llSetPos() in the child prims unless you want them positioned differently in relation to the root prim.

Also, child prim movement is limited by the "link distance", which is a variable distance, based on the size of the prim relative to the size of the rest of the linkset. Attempting to move a prim farther than the link distance will also silently fail.
Milambus Oh
Registered User
Join date: 6 Apr 2007
Posts: 224
05-14-2007 12:20
Try unlinking all of the objects then relinking them. I've has some odd behavior when adding new prims into a linkset.
Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
05-14-2007 18:53
Talarus is correct. I was trying to move the roof too far from the rest of the house and it was silently failing. I had to experiment with dirrerent distances until I found one that did not fail. It all works ok now. Thanks folks.