Jump to content

move object based on its rotation


Guest
 Share

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

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

Recommended Posts

If that's pretty much the intended motion except you want the child prims to bounce in and out from the center, maybe something like this could be adapted and added to what you've got already:

list childOffsets;
integer bouncing;
integer expanding;
float travelPart = 1.0;

float interp(float t)
{   // from Nexii Malthus' http://wiki.secondlife.com/wiki/Interpolation/Cosine/Float
    // with range from 0.2 to 1.0
    float F = (1-llCos(t*PI))/2;
    return 0.2*(1-F)+1.0*F;
}
    
default
{
    state_entry()
    {
        integer childLink = llGetNumberOfPrims();
        do
            childOffsets = llList2Vector(llGetLinkPrimitiveParams(childLink, [PRIM_POS_LOCAL]), 0) + childOffsets;
        while (1 < --childLink);
    }
    touch_start(integer total_number)
    {
        llSetTimerEvent(llList2Float([0.0, 0.1], bouncing = !bouncing));
    }
    timer()
    {
        travelPart += llList2Float([-0.1, 0.1], expanding);
        if (travelPart > 1.0)
        {
            travelPart = 1.0;
            expanding = FALSE;
        }
        else
        if (travelPart < 0.0)
        {
            travelPart = 0.0;
            expanding = TRUE;
        }
        integer childLink = llGetNumberOfPrims();
        list paramList;
        do
            paramList += 
                [ PRIM_LINK_TARGET, childLink
                , PRIM_POS_LOCAL, llList2Vector(childOffsets, childLink-2) * interp(travelPart)
                ];
        while (1 < --childLink);
        llSetLinkPrimitiveParamsFast(LINK_THIS, paramList);
    }
}

This particular script takes the child positions at the time of reset to be the maximum distance from the root, so if it's stopped mid-way and reset, it will travel a shorter path, and shorter, and shorter with each reset. That's not how you'd want to do it for real, of course; you might do something like dump the initial childOffsets to chat and save that as a constant. But for now I'm just trying to figure out if this is even the motion you're trying to achieve.

  • Thanks 1
Link to comment
Share on other sites

That's exactly what i want them to do! NYAAA <3 thank you so much! 

even though i would have love to write it myself that looks inside my abilities to manage so ill take it!



 Now i just need to fuse it with my color changing script.  get the whole thing spinning and being controlled from a distance. got my work cut out this weekend! 
ill upload the finished thing when im done!

Edited by Melkanea
Link to comment
Share on other sites

I believe i must explain myself to the reason of wanting to create this particular object for no real reason.
One part is to learn and toy with LSL, the second part is a long long past kids dream. Animate with script and create that exact object for a map i designed in Quake 2 . never managed to do it. 
Now with your help i did!

Thank you all since i finally have time to live my second life. better late than never! Chuckles

Edited by Melkanea
  • Like 2
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1940 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...