Jump to content

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


portexploits
 Share

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

3 minutes ago, Quistess Alpha said:

llMoveToPos() in an attachment works fairly well, but you might have to do a few conversions and tests to get it to do exactly what you want.

I have used llMoveToTarget() the speed for that is the same about 197m/s but I'll look into llMoveToPos()

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

for practical purposes I would suggest going with Quitess's control key pusher method

keep shoving the avatar while a key is pressed: parameter level != 0

when no key is pressed: level == 0 then stop pushing: vector dir = <0,0,0>

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...