Jump to content
SwireD

Non-linked rotation

Recommended Posts

Hello! a friend of mine asked me a puzzle. How to make the object rotate or move along a certain path (circle)? there will be several such objects (dancepads - one script for each pad...), but the main problem - they cannot be linked to anything! I read somewhere that it is possible to specify the coordinates and the object will move from point to point. how to do it and is there any other way? 

As example - solar system.

Edited by SwireD

Share this post


Link to post
Share on other sites
12 hours ago, Rolig Loon said:

Study llSetKeyframedMotion.  There are several examples in the LSL wiki.

Thank you very much! I managed to create such a script. works almost - after passing the entire circle, the object stops at one point for 3 seconds. How to avoid it? and also if I add on/off toggle then after stop/start the path breaks and the objects begin to move along a different trajectory. Is it possible to keep the path? and the only way to get all the platforms to rotate along one trajectory for me was possible only by placing all the platforms at one point and adding a llSleep() for each subsequent platform with magnification.

default
{
    state_entry()
    {
        llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_CONVEX]);
        llSetKeyframedMotion([<0,0,0>, 3, <1.5,3.5,0>, 3, <3.5,1.5,0>, 3, <3.5,-1.5,0>, 3, <1.5,-3.5,0>, 3, <-1.5,-3.5,0>, 3, <-3.5,-1.5,0>, 3, <-3.5,1.5,0>, 3, <-1.5,3.5,0>, 3 ], [KFM_DATA, KFM_TRANSLATION, KFM_MODE, KFM_LOOP]);
    }
}

 

Edited by SwireD

Share this post


Link to post
Share on other sites

There is quite a lot to KFM.  You have only begun to explore its possibilities. I suggest spending some time reading and then experimenting with the KFM_MODE option to see what it has to offer. 

  • Thanks 1

Share this post


Link to post
Share on other sites
9 hours ago, SwireD said:

Thank you very much! I managed to create such a script. works almost - after passing the entire circle, the object stops at one point for 3 seconds. How to avoid it? and also if I add on/off toggle then after stop/start the path breaks and the objects begin to move along a different trajectory. Is it possible to keep the path? and the only way to get all the platforms to rotate along one trajectory for me was possible only by placing all the platforms at one point and adding a llSleep() for each subsequent platform with magnification.


default
{
    state_entry()
    {
        llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_CONVEX]);
        llSetKeyframedMotion([<0,0,0>, 3, <1.5,3.5,0>, 3, <3.5,1.5,0>, 3, <3.5,-1.5,0>, 3, <1.5,-3.5,0>, 3, <-1.5,-3.5,0>, 3, <-3.5,-1.5,0>, 3, <-3.5,1.5,0>, 3, <-1.5,3.5,0>, 3 ], [KFM_DATA, KFM_TRANSLATION, KFM_MODE, KFM_LOOP]);
    }
}

 

That looks incorrect. The list for keyframed motion is "relative position, relative rotation, time delay" by default. If you want position only, you have to provide KFM_DATA, KFM_TRANSLATION in the modes. And the PRIM_PHYSICS_SHAPE_TYPE info is obsolete; that was for pre-mesh viewers.

It stops at the end for 3 seconds because you told it to stop at the end for 3 seconds. Change that last time to 0.100 second.

KFM_LOOP is kind of interesting. It doesn't just do all the steps again. It instantaneously moves the object back to the starting position and runs the steps again. This has its uses; I use it in my escalators.

  • Thanks 1

Share this post


Link to post
Share on other sites
53 minutes ago, animats said:

And the PRIM_PHYSICS_SHAPE_TYPE info is obsolete; that was for pre-mesh viewers.

Pretty sure this is still necessary to get KFM to work if the object is made of prims without anything (such as a Materials-bearing face) forcing them to Mesh LI accounting.

[EDIT: Now that I scroll the code to the end, I think the KFM_DATA, KFM_TRANSLATION is in the options list as required; KFM_MODE is just another component of the options list. The stopping for 3 seconds is indeed in the data list, but it's the "<0,0,0>" bit at the beginning which happens again when KFM_LOOP returns to the start of the data list.]

Edited by Qie Niangao
  • Thanks 1

Share this post


Link to post
Share on other sites
5 minutes ago, Qie Niangao said:
55 minutes ago, animats said:

And the PRIM_PHYSICS_SHAPE_TYPE info is obsolete; that was for pre-mesh viewers.

Pretty sure this is still necessary to get KFM to work if the object is made of prims without anything (such as a Materials-bearing face) forcing them to Mesh LI accounting.

Yes.  And in any case, it can't hurt.  At worst, it's redundant if the item is already set to CONVEX_HULL.

  • Thanks 2

Share this post


Link to post
Share on other sites

Hi! Works much better! Thank you all! I had to use different coords for each platform.

default
{
    state_entry()
    {
        llListen(10, "", "", "");
    }

    listen(integer chan, string name, key id, string msg)
    {
        if (msg == "stop")
        {
            llSetKeyframedMotion([], [KFM_COMMAND, KFM_CMD_PAUSE]);
        }
        else if (msg == "start")
        {
            llSetKeyframedMotion([], [KFM_COMMAND, KFM_CMD_PLAY]);
            llSetKeyframedMotion([ < 3.5, -1.5, 0 > , 3, < 1.5, -3.5, 0 > , 3, < -1.5, -3.5, 0 > , 3, < -3.5, -1.5, 0 > , 3, < -3.5, 1.5, 0 > , 3, < -1.5, 3.5, 0 > , 3, < 1.5, 3.5, 0 > , 3, < 3.5, 1.5, 0 > , 3], [KFM_DATA, KFM_TRANSLATION, KFM_MODE, KFM_LOOP]);
        }
    }
}

 

Edited by SwireD
  • Like 2

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...