Jump to content
ainst Composer

Sliding linked four parts door script

Recommended Posts

Hello! I need to create four parts linked to house sliding door like on picture. all parts move frome one position in the linkset to another. 

Any suggestions greatly appreciated!

Snapshot_002.thumb.png.975687b4f75ddf67ec50e2ddbc02dc37.png

Snapshot_003.thumb.png.824f03a75bcf32daf55491db78425e3c.png

Share this post


Link to post
Share on other sites
1 hour ago, steph Arnott said:

If you slide them it is likely to judder horribly. Use the scale function. http://wiki.secondlife.com/wiki/LlSetScale

Hello! Thanks very much for your answer!

You see this sliding effect is required...

llSetPos(llGetPos() + <0.0,0.0,10.0>);  <<< сan I use it for this?

and it doesn't seem to work if I link the door to the house.

(It can even be 4 scripts for each part so that they work simultaneously.)

Edited by ainst Composer

Share this post


Link to post
Share on other sites
1 minute ago, ainst Composer said:

Hello! Thanks very much for your answer!

You see this sliding effect is required...

llSetPos(llGetPos() + <0.0,0.0,10.0>);  <<< сan I use it for this?

(It can even be 4 scripts for each part so that they work simultaneously.)

Yes, but it not vey realistic viewing wise. You can set the shrink to be a percievable movement rather than a snap, snap movement.

  • Thanks 1

Share this post


Link to post
Share on other sites

llSetScale() by itself only affects the single prim in which the script resides - which means if you were to use that, you'd need a script for each prim of the door, plus additional logic to synchronize everything.

Instead of that, I would suggest you look at llSetLinkPrimitiveParamsFast(). This single command can be used to target each child prim at the same time with just one command using the LINK_TARGET for each child. And using its other constant PRIM_SIZE which is equivalent to llSetScale.

Edited by Fenix Eldritch
  • Like 1
  • Thanks 2

Share this post


Link to post
Share on other sites
1 minute ago, Fenix Eldritch said:

llSetScale() by itself only affects the single prim in which the script resides - which means if you were yo use that, you'd need a script for each prim of the door, plus additional logic to synchronize everything.

Instead of that, I would suggest you look at llSetLinkPrimitiveParamsFast(). This single command can be used to target each child prim at the same time with just one command using the LINK_TARGET. And using its other constant PRIM_SIZE which is equivalent to llSetScale.

Which the server has to calculate. One prim with a basic texture applied is all that is needed. The shrink can be time linited to get a plausable closure.

  • Thanks 1

Share this post


Link to post
Share on other sites
6 minutes ago, Fenix Eldritch said:

llSetScale() by itself only affects the single prim in which the script resides - which means if you were yo use that, you'd need a script for each prim of the door, plus additional logic to synchronize everything.

Instead of that, I would suggest you look at llSetLinkPrimitiveParamsFast(). This single command can be used to target each child prim at the same time with just one command using the LINK_TARGET for each child. And using its other constant PRIM_SIZE which is equivalent to llSetScale.

 

2 minutes ago, steph Arnott said:

Which the server has to calculate. One prim with a basic texture applied is all that is needed. The shrink can be time linited to get a plausable closure.

But will this affect texture (shrink / stretch)?

Share this post


Link to post
Share on other sites

I don't understand what you are saying, Steph. The server has to make calculations in either case.

llSetScale(<1.0,1.0,1.0>) and llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_SCALE, <1.0,1.0,1.0>]) are functionally the same, are they not?

  • Like 1

Share this post


Link to post
Share on other sites
13 minutes ago, Fenix Eldritch said:

I don't understand what you are saying, Steph. The server has to make calculations in either case.

llSetScale(<1.0,1.0,1.0>) and llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_SCALE, <1.0,1.0,1.0>]) are functionally the same, are they not?

Trying to get it to one prim and not multiple. The door does not need to be four.

Edited by steph Arnott
  • Thanks 1

Share this post


Link to post
Share on other sites
2 minutes ago, steph Arnott said:

You shift the text offset. 

 

2 minutes ago, Fenix Eldritch said:

I don't understand what you are saying, Steph. The server has to make calculations in either case.

llSetScale(<1.0,1.0,1.0>) and llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_SCALE, <1.0,1.0,1.0>]) are functionally the same, are they not?

the parts themselves should not stretch or shrink, they simply move to another position behind each other.

Snapshot_001.png

Snapshot_002.png

Share this post


Link to post
Share on other sites

Ok, I see what happened now. It wasn't clear that you were suggesting the OP switch to using a single prim instead of four.

My response was under the assumption that the OP wanted to keep using the four prim design. In which case, llSetLinkPrimitiveParamsFast  would be a viable option to move all four prims at once.

Edit: and if you don't want to stretch/shrink the scale, you can alter the prims' offsets instead using the same function.

Edited by Fenix Eldritch
  • Thanks 1

Share this post


Link to post
Share on other sites

So just do as Fenix suggests. Write a single SLPPF statement that combines commands for each prim (using PRIM_LINK_TARGET) and moves the link with an offset in both X and Y, as appropriate.  It's very straightforward.  You can put your script into any part of the linkset, including the house that the entire door is linked to.

  • Thanks 1

Share this post


Link to post
Share on other sites
4 minutes ago, Rolig Loon said:

So just do as Fenix suggests. Write a single SLPPF statement that combines commands for each prim (using PRIM_LINK_TARGET) and moves the link with an offset in both X and Y, as appropriate.  It's very straightforward.  You can put your script into any part of the linkset, including the house that the entire door is linked to.

Does not change the fact four prims is three more than needed. RL mech in SL is a pointless endevour.

  • Thanks 1

Share this post


Link to post
Share on other sites
6 minutes ago, Rolig Loon said:

So just do as Fenix suggests. Write a single SLPPF statement that combines commands for each prim (using PRIM_LINK_TARGET) and moves the link with an offset in both X and Y, as appropriate.  It's very straightforward.  You can put your script into any part of the linkset, including the house that the entire door is linked to.

So i started with something like this:

default
{
    touch_start(integer num_detected)
    {
        llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_LINK_TARGET,
                            PRIM_POS_LOCAL]);
    }
}

 

Share this post


Link to post
Share on other sites
2 minutes ago, steph Arnott said:

Does not change the fact four prims is three more than needed. RL mech in SL is a pointless endevour.

I absolutely agree with you but I was asked to do just that

Share this post


Link to post
Share on other sites
1 minute ago, ainst Composer said:

I absolutely agree with you but I was asked to do just that

What people ask is 99% based on not knowing a more conservative way.

  • Thanks 1

Share this post


Link to post
Share on other sites

I think it's a matter of taste... Yes, fewer prims are generally preferable, but perhaps the OP wants the aesthetics of a four-paneled sliding door. 4 vs 1 is relatively low in terms of impact, and from a Land Impact perspective, you can knock that down to 2 if you change the prims to use convex hull.

 

As for using the command, do note that the list follows the format "CONSTANT, value". So PRIM_LINK_TARGET must be followed by the actual link number you want to target. And PRIM_POS_LOCAL must be followed by the vector of the new position you wish to apply. And all elements in the list are comma separated.

Edited by Fenix Eldritch
  • Thanks 1

Share this post


Link to post
Share on other sites
1 minute ago, Fenix Eldritch said:

I think it's a matter of taste... Yes, fewer prims are generally preferable, but perhaps the OP wants the aesthetics of a four-paneled sliding door. 4 vs 1 is relatively low in terms of impact, and from a Land Impact perspective, you can knock that down to 2 if you change the prims to use convex hull.

 

As for using the command, do note that the list follows the format "CONSTANT, value". So PRIM_LINK_TARGET must be followed by the actual link number you want to target. And PRIM_POS_LOCAL must be followed by the vector of the new position you which to apply. And all elements in the list are comma separated.

Four prims to many on a limit is a real issue to them. They want a fifty prim look on a two prim object.

  • Thanks 1

Share this post


Link to post
Share on other sites
11 minutes ago, Fenix Eldritch said:

I think it's a matter of taste... Yes, fewer prims are generally preferable, but perhaps the OP wants the aesthetics of a four-paneled sliding door. 4 vs 1 is relatively low in terms of impact, and from a Land Impact perspective, you can knock that down to 2 if you change the prims to use convex hull.

 

As for using the command, do note that the list follows the format "CONSTANT, value". So PRIM_LINK_TARGET must be followed by the actual link number you want to target. And PRIM_POS_LOCAL must be followed by the vector of the new position you which to apply. And all elements in the list are comma separated.

integer DOOR_PRIM = 2;   
integer DOOR_PRIM_2 = 3; 
integer DOOR_PRIM_3 = 4; 
integer DOOR_PRIM_4 = 5; 

default
{
    touch_start(integer num_detected)
    {
    llSetLinkPrimitiveParamsFast( 
    DOOR_PRIM,  PRIM_LINK_TARGET, PRIM_POS_LOCAL, <0,0,0>,
    DOOR_PRIM_2,PRIM_LINK_TARGET, PRIM_POS_LOCAL, <0,0,0>,
    DOOR_PRIM_3,PRIM_LINK_TARGET, PRIM_POS_LOCAL, <0,0,0>,
    DOOR_PRIM_4,PRIM_LINK_TARGET, PRIM_POS_LOCAL, <0,0,0>]);
    }
}

I did something incomprehensible

Share this post


Link to post
Share on other sites

Close, the format is a little off, and you're missing the start of the list "["

llSLPPF() takes two inputs, a link number and a list of stuff to alter. That format must be adhered to, so your first link number can be the first prim of your target set. Then the list starts, so your first entry would be the prim pos local keyword followed by the value to apply - for that first child prim (DOOR_PRIM in this case). Then after that, you get into the pattern of specifying additional prim link targets, the attribute keyword, and the associated value, etc, etc.

llSetLinkPrimitiveParamsFast( DOOR_PRIM, [ PRIM_POS_LOCAL, <0,0,0>,
      PRIM_LINK_TARGET,DOOR_PRIM_2, PRIM_POS_LOCAL, <0,0,0>,
      PRIM_LINK_TARGET,DOOR_PRIM_3, PRIM_POS_LOCAL, <0,0,0>,
      PRIM_LINK_TARGET,DOOR_PRIM_4, PRIM_POS_LOCAL, <0,0,0>]);

 

Edited by Fenix Eldritch
goofed up the order
  • Thanks 1

Share this post


Link to post
Share on other sites
31 minutes ago, Fenix Eldritch said:

Close, the format is a little off, and you're missing the start of the list "["

llSLPPF() takes two inputs, a link number and a list of stuff to alter. That format must be adhered to, so your first link number can be the first prim of your target set. Then the list starts, so your first entry would be the prim pos local keyword followed by the value to apply - for that first child prim (DOOR_PRIM in this case). Then after that, you get into the pattern of specifying additional prim link targets, the attribute keyword, and the associated value, etc, etc.


llSetLinkPrimitiveParamsFast( DOOR_PRIM, [
      PRIM_POS_LOCAL, <0,0,0>,
      DOOR_PRIM_2,PRIM_LINK_TARGET, PRIM_POS_LOCAL, <0,0,0>,
      DOOR_PRIM_3,PRIM_LINK_TARGET, PRIM_POS_LOCAL, <0,0,0>,
      DOOR_PRIM_4,PRIM_LINK_TARGET, PRIM_POS_LOCAL, <0,0,0>]);

 

    When i make it:

  llSetLinkPrimitiveParamsFast( DOOR_PRIM, [
      PRIM_POS_LOCAL, <0,1,0>,
      DOOR_PRIM_2,PRIM_LINK_TARGET, PRIM_POS_LOCAL, <0,2,0>,
      DOOR_PRIM_3,PRIM_LINK_TARGET, PRIM_POS_LOCAL, <0,3,0>,
      DOOR_PRIM_4,PRIM_LINK_TARGET, PRIM_POS_LOCAL, <0,4,0>]);

it acts this way, only first prim moves, and whole link set jumps up a little and disappears after a while.

ezgif.com-video-to-gif.gif

Share this post


Link to post
Share on other sites

and it becomes physical, temporary and phantom, i see why it jumps - its physical, because of my clicks

Edited by ainst Composer

Share this post


Link to post
Share on other sites

That's because the order of parameters in the list is wrong.  Refer to the LSL wiki:.  It should be

llSetLinkPrimitiveParamsFast( DOOR_PRIM, [
      PRIM_LINK_TARGET, DOOR_PRIM_2,PRIM_POS_LOCAL, <0,0,0>,
      PRIM_LINK_TARGET, DOOR_PRIM_3,PRIM_POS_LOCAL, <0,0,0>,
      PRIM_LINK_TARGET, DOOR_PRIM_4,PRIM_POS_LOCAL, <0,0,0>]);

Using the correct offset vectors, of course.  ;)

Edited by Rolig Loon
  • Thanks 1

Share this post


Link to post
Share on other sites

Sorry, I had an error in my previous post. I had incorrectly posted my example with things in the wrong order. I did edit it, but I might not have been fast enough. Re-check my post and try what's currently there.

  • Thanks 1

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.


×
×
  • Create New...