Jump to content

Best method for slowing an avatars movement speed


ItHadToComeToThis
 Share

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

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

Recommended Posts

It really depends on what your intention is. If you want to absolutely prevent an avatar from moving faster than X meters per Y time, create a "cage" that is slightly bigger than the avatar's hitbox and make it snap to the avatar's position every time the avatar touches the cage. This way, the avatar can kind of "push" the cage in the direction they want to go, but cannot go past it even if they have some kind of movement enhancers. I've only seen this approach in combat sims though, where oppressive tactics are kind of the norm.

Another alternative for complete movement control is llMoveToTarget, where the time to reach some nearby position is long enough to be slow and smooth. This only really works on flat ground or for flying (and if the script is attached to the avatar), though. Detection of upward/downward slopes gets too fiddly with raycasting.

Edited by Wulfie Reanimator
  • Thanks 1
Link to comment
Share on other sites

the smoothest way I know is to use llApplyImpulse in an attachment.  Something like:
 

float IMPULSE = 1.6;

... get perms ... take controls ...

    control(key id, integer level, integer edge)
    {
        vector v;
        if (level & CONTROL_FWD)
            v.x = -IMPULSE;
        else if (level & CONTROL_BACK)
            v.x = IMPULSE;
        else if (level & CONTROL_LEFT)
            v.y = -IMPULSE;
        else if (level & CONTROL_RIGHT)
            v.y = IMPULSE;
        llApplyImpulse(v, TRUE);
    }  

 

  • Thanks 1
Link to comment
Share on other sites

  • 2 weeks later...
You are about to reply to a thread that has been inactive for 1257 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...