Jump to content
Sign in to follow this  
Deep Semaphore

How to move root of a linkset through scripting.

Recommended Posts

Hello,

Here's what I am trying to achieve. I have a linked object. I want to be able to click anywhere on the linked object and have the root prim move to the clicked point. 

 

Caveat: I cannot use llBreakLinks functions etc... or llCreateLink because this will require permission requests and so on which will destroy usability.

If you have a solution and you want payment for it, don't hesitate to let me know personally.

I am happy to hear ideas or views on the thread about this problem.

Regards

Share this post


Link to post
Share on other sites

Do you want all the child prims to stay on the global positions they had before you move the root?

In that case you just compensate for the position change of the root
Change the root the amount vector V and all child prims -V

Share this post


Link to post
Share on other sites

When you do as Dora suggests, remember that you are moving the entire linkset in the first step and then moving each of the child prims back where it was.  Your first step, therefore, involves llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_POSITION, llGetPos() + <x,y,z>*llGetRot()]) .  The second step, however, has to involve two substeps, because you are changing the child prims' LOCAL positions.  In the first substep, you need to llGetLinkPrimitiveParams(linkno,[PRIM_POS_LOCAL]); and the second step has to involve llSetLinkPrimitiveParamsFast(linkno,[PRIM_POS_LOCAL, the_old_prim_pos_local - <x,y,z> * llGetRot()]) .  The two parts are, of course, in a loop so that you step through each child prim in the link set.

Share this post


Link to post
Share on other sites

A voice from beyond also reminds me that it's sometimes useful to think around the problem instead of throwing yourself straight at it.  Moving the root prim as I described it is the correct way to do it, but it might be simpler to re-link your linkset and make a different prim the root.  Then, instead of moving the entire linkset and laboriously moving everything except the root back where it started, you just move ONE child prim.  If it's really important that you move a prim that is exactly where the root prim is, you could also fake it. Put a second prim exactly where the root prim is and move it instead, perhaps making the root transparent to hide the fact that it never moved.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...