Jump to content

slowing a rotation to a stop


Pedlar Decosta
 Share

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

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

Recommended Posts

Hi, I'm looking for some tips on the best way to slow a rotation down until it stops, rather than just rotating or stopping. It is for someone who wants to make a ride. I'm using llEulerRot() to turn it for a certain amount of time, but don't want the stop to be so jarring.

Any help is appreciated.

Link to comment
Share on other sites

llEuler2Rot isn't really for turning things, did you mean llTargetOmega?

You can actually use llSetLinkPrimitiveParamsFast(link,[PRIM_ROT_LOCAL... on a timer or in a loop to do the rotation but it might be a bit "stuttery" for lack of a better term.

Another possibility is to look into llSetKeyframeMotion() for the rotation. You could loop a 90 degree rotation and when you want it to stop add keyframes with smaller and smaller angles for the same timestep.

integer gON;
 
default
{
    touch_start(integer total_number)
    {
        gON = !gON;
        if (gON)
        {
            // Make repeated rotations of PI/2 radians, each taking 0.5 seconds
            llSetKeyframedMotion(
            [  llAxisAngle2Rot(<0,0,1>,PI_BY_TWO), 0.5],
            [  KFM_DATA,KFM_ROTATION, KFM_MODE,KFM_LOOP]);
        }
        else
        {
            llSetKeyframedMotion(
            [  llAxisAngle2Rot(<0,0,1>,PI_BY_TWO), 0.5,
               llAxisAngle2Rot(<0,0,1>,PI_BY_TWO*0.8), 0.5,
               llAxisAngle2Rot(<0,0,1>,PI_BY_TWO*0.6), 0.5,
               llAxisAngle2Rot(<0,0,1>,PI_BY_TWO*0.4), 0.5,
               llAxisAngle2Rot(<0,0,1>,PI_BY_TWO*0.2), 0.5
            ],
            [  KFM_DATA,KFM_ROTATION, KFM_MODE,KFM_FORWARD]);
        }
    }
}

(wasn't going to do an example, but the example script from the wiki was easy to modify)

http://wiki.secondlife.com/wiki/LlSetKeyframedMotion

Edited by Quistessa
added example
  • Thanks 1
Link to comment
Share on other sites

4 hours ago, Quistessa said:

llEuler2Rot isn't really for turning things, did you mean llTargetOmega?

Yeah, sorry. I'm trying to stay productive with a dose of the flu. Can't think straight. llSetKeyFramedMotion() is what I should have said. I just wasn't sure how to degrade it and hopefully make it smooth. I figured it would be kind of jerky. So thanks so much for the example. It helps a lot.

  • Like 1
Link to comment
Share on other sites

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