Jump to content

Moving linked object with llSetLinkPrimitiveParams


Ally Whitefalcon
 Share

You are about to reply to a thread that has been inactive for 1759 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I'm having a problem that is probably due to my overlooking something obvious, but I'm not a programmer and i"m pretty new to scripting, and this has me stumped. Sorry if this is something obvious to most of you.

My real situation is more complicated, but I've been able to reproduce it in a much simpler context. If I create two objects, and link them. I'll name one O1 and the other O2. Then the following script:

    touch_start(integer total_number)
    {
        integer o1;
        integer o2;
        
        integer i =  llGetNumberOfPrims();
        for (; i >= 0; --i)
        {
            string linkName = llGetLinkName(i);
            if (linkName == "O1")
            {
                o1 = i; 
            }
            else if (linkName == "O2")
            {
                o2 = i;
            }
        }
        
        vector pos = llList2Vector(llGetLinkPrimitiveParams(o1, [PRIM_POSITION]), 0);
        llSetLinkPrimitiveParamsFast(o1, [PRIM_POSITION, pos + <0.0, 0.0, 0.1>]);
    }
 

if I do it as written, both O1 and O2 jump .1 m upwards. If I edit it so it's operating on o2, nothing at all happens. I can edit and set the positions, and they do the right thing, but this script either moves both or neither, depending on whether I try to move o1 or o2. 

Are they somehow locked together? I've tried it with a few different groups of linked objects, and I get the same results every time. Can someone tell me what I'm doing wrong? pleeeeeease?

Thanks!

Link to comment
Share on other sites

Even then, of you move the root prim of a linkset, the entire object will move. To move only the root, you'll need to move the whole thing and then reposition the child prims to put them back where they were. It's awkward,  but remember that "local" means "position relative to the root," so moving the root relative to itself means moving everything.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1759 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...