Jump to content

How do I make my avatar go at a velocity of 250 m/s?


portexploits
 Share

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

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

Recommended Posts

Hello,
    I have used this HUD that made my avatar move at 250m/s.  I am trying to make my own HUD that goes at that velocity.  I have tried llSetVelocity(vector,int) but it is instantaneous. It gives a little push then stops. When I put it in a timer, the velocity flutters, goes up and down, even if I have the timer at 0.01. I do see it hit the velocity 250 m/s, but as I said it flutters. When I do llSetForce(vector,int) at the maximum force, I get the maximum velocity of about 197 m/s.  How do I make my avatar move at a consistent velocity of 250 m/s?

Edited by portexploits
  • Like 1
Link to comment
Share on other sites

Interesting, I ran a few tests of my own. Despite being able to get llGetVel() to report speeds up to 250, empirically measuring your speed (time yourself going up for 10 seconds and see how far you go) seems to suggest such fast speeds aren't really possible and are only telling you what you want to hear. my empirically measured max speed is about 83 meters per second:

default
{
    state_entry()
    {
        llResetTime();
        while(TRUE)
        {
            //vector vel = (vector)llGetObjectDesc();
            vector vel = <0,0,300>;
            llSetVelocity(vel,TRUE);
            llSleep(0.02-llGetAndResetTime());
            llSetText((string)llGetVel(),<1,1,0>,1.0);
        }
    }
}

and just for fun, you can use this to modulate the speed:

default
{
    state_entry()
    {
        llRequestPermissions(llGetOwner(),PERMISSION_TAKE_CONTROLS);
    }
    attach(key ID)
    {   if(ID)
        llRequestPermissions(ID,PERMISSION_TAKE_CONTROLS);
    }
    run_time_permissions(integer perms)
    {
        if(perms&PERMISSION_TAKE_CONTROLS)
        {
            llTakeControls(
                CONTROL_UP|
                CONTROL_DOWN|
                CONTROL_LEFT|
                CONTROL_RIGHT|
                CONTROL_FWD|
                CONTROL_BACK|
                0,TRUE,FALSE);
        }
    }
    control(key ID, integer level, integer edge)
    {
        vector dir = 300* 
        <   !!(level&CONTROL_FWD)-!!(level&CONTROL_BACK),
            !!(level&(CONTROL_LEFT))-!!(level&(CONTROL_RIGHT)),
            !!(level&CONTROL_UP)-!!(level&CONTROL_DOWN)
        >;
        llSetLinkPrimitiveParamsFast(LINK_THIS,
        [   PRIM_DESC, (string)dir]);
    }
}

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

22 minutes ago, Quistess Alpha said:

Interesting, I ran a few tests of my own. Despite being able to get llGetVel() to report speeds up to 250, empirically measuring your speed (time yourself going up for 10 seconds and see how far you go) seems to suggest such fast speeds aren't really possible and are only telling you what you want to hear. my empirically measured max speed is about 83 meters per second:

default
{
    state_entry()
    {
        llResetTime();
        while(TRUE)
        {
            //vector vel = (vector)llGetObjectDesc();
            vector vel = <0,0,300>;
            llSetVelocity(vel,TRUE);
            llSleep(0.02-llGetAndResetTime());
            llSetText((string)llGetVel(),<1,1,0>,1.0);
        }
    }
}

and just for fun, you can use this to modulate the speed:

default
{
    state_entry()
    {
        llRequestPermissions(llGetOwner(),PERMISSION_TAKE_CONTROLS);
    }
    attach(key ID)
    {   if(ID)
        llRequestPermissions(ID,PERMISSION_TAKE_CONTROLS);
    }
    run_time_permissions(integer perms)
    {
        if(perms&PERMISSION_TAKE_CONTROLS)
        {
            llTakeControls(
                CONTROL_UP|
                CONTROL_DOWN|
                CONTROL_LEFT|
                CONTROL_RIGHT|
                CONTROL_FWD|
                CONTROL_BACK|
                0,TRUE,FALSE);
        }
    }
    control(key ID, integer level, integer edge)
    {
        vector dir = 300* 
        <   !!(level&CONTROL_FWD)-!!(level&CONTROL_BACK),
            !!(level&(CONTROL_LEFT))-!!(level&(CONTROL_RIGHT)),
            !!(level&CONTROL_UP)-!!(level&CONTROL_DOWN)
        >;
        llSetLinkPrimitiveParamsFast(LINK_THIS,
        [   PRIM_DESC, (string)dir]);
    }
}

 

Thanks, that's great. I see a major difference in how you're iterating the SetVelocity(vector, int). You're using a loop, I was doing it in a timer. So how would I break out of the loop to stop it? I know a trick to do it, but if you have a suggestion on how to do so, I am open ears.

Link to comment
Share on other sites

7 hours ago, portexploits said:

Thanks, that's great. I see a major difference in how you're iterating the SetVelocity(vector, int). You're using a loop, I was doing it in a timer. So how would I break out of the loop to stop it? I know a trick to do it, but if you have a suggestion on how to do so, I am open ears.

One way is to check for some kind of external factor in the loop-condition, such as the name/color of an object, which would be changed by a separate script that isn't stuck in a loop.

Link to comment
Share on other sites

10 hours ago, portexploits said:

You're using a loop, I was doing it in a timer. So how would I break out of the loop to stop it? I know a trick to do it, but if you have a suggestion on how to do so, I am open ears.

you have a few options, although for all of them, I'd recommend having the loop-script and the control script separated: 

1) don't stop the loop. Always check the object description (or other prim parameter) and set the speed/force/moveto based on that. you could also check for a special value ("stop"/"pause") and stop the movement in that case (don't setVel/llSetForce(ZERO_VECTOR)/llStopMoveTo())

2) Loop only for a given duration, something like:

integer stime=llGetUnixTime();
while(llGetUnixTime<stime+30)
{ // ...
}

3) was another one, but I'm forgetting it. . .

Link to comment
Share on other sites

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