Jump to content

Character Movement


TessaAnnaMarie
 Share

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

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

Recommended Posts

I have tried several ways to script it myself. Looked up several forums and what not. 

Can someone point me in the right direction for slowing movement speed / stopping it all together? I'll be blunt, I'm looking to slow down speed similar to how RR (Real Restraints) Cuffs slow the avatar. I understand the animation side, that I need to slow the animation time / make a new one (I will be making a new one for the need that I need this for). But everything I've tried is "Clunky."

If someone knows the system I am talking about and knows the right direction. I would love to be pointed in the direction so I can bring a project... or 7 I'm working to, to life. 

Link to comment
Share on other sites

16 hours ago, TessaAnnaMarie said:

stopping it all together?

For a restrictive thing, you may want to consider llMoveToPos() the wearer's current position in adition to taking their controls and doing nothing with them. other than that, see what @elleevelyn linked. The best methods I've found are allowing the underlying SL movement and applying a reverse force, or directly setting the avatars velocity given their input. Both can have some nasty side-effects if edge-cases aren't carefully considered. llMoveToPos() as the movement mechanism would also work, but it interacts badly with jumping.

 

Link to comment
Share on other sites

On 10/20/2023 at 3:26 AM, elleevelyn said:

 

for slowing avatar movement then Quistess shows the basic howto here

 

Thank you for this. Works wonders for moving forward. However I ran into 2 issues. 

 vector move = llVecNorm(
                <-1, 0,0.0>*!(level&CONTROL_FWD) +
                < 1, 0,0.0>*!(level&CONTROL_BACK)+
                < 0,-1,0.0>*!(level&CONTROL_LEFT)+
                < 0, 1,0.0>*!(level&CONTROL_RIGHT));
            vector turn = 
                <0,-1,0>*!(level&CONTROL_ROT_LEFT)+
                <0, 1,0>*!(level&CONTROL_ROT_RIGHT);
            if(level&CONTROL_BACK)
            {
                llSetForce(<0,0,0>,TRUE);
                move=-move;
                turn=-turn;
                gShoulder = <0,0,0>;
            }    
            else
            {
                llSetForce((Speed*move)+<0,0,1>,TRUE);
                vector vel = llGetVel();
                if(vel.z>0) vel.z = 0;
                llSetVelocity(vel,FALSE);

}

When I move Forward, like I said it works perfect. 

1st issue: However when I click "S" or the Back arrow, I move at normal speed. 

2nd issue: When I hold down the forward key, and then press the break button (Space) the avatar turns around and SPRINTS full speed. Need this to not happen. 

 

20 hours ago, Quistess Alpha said:

For a restrictive thing, you may want to consider llMoveToPos() the wearer's current position in adition to taking their controls and doing nothing with them. other than that, see what @elleevelyn linked. The best methods I've found are allowing the underlying SL movement and applying a reverse force, or directly setting the avatars velocity given their input. Both can have some nasty side-effects if edge-cases aren't carefully considered. llMoveToPos() as the movement mechanism would also work, but it interacts badly with jumping.

 

I found out I can remove all movements with llTakeControl() - Thanks for this. I did try llMovetoPos, but it interacted weirdly. I've determined I need to separate them. I'd be happy if Moving forward would slow speed and backwards would stop it. But every way I try even with llmovetopos, it just gets buggy.. then screws up the move forward. 

Link to comment
Share on other sites

1 hour ago, TessaAnnaMarie said:

1st issue: However when I click "S" or the Back arrow, I move at normal speed. 

because that script specifically avoids changing the backwards movement speed due to problems with AOs that use llOverrideAnimation()

1 hour ago, TessaAnnaMarie said:

2nd issue: When I hold down the forward key, and then press the break button (Space) the avatar turns around and SPRINTS full speed. Need this to not happen. 

There's not much you can do to fight against "adverse use" when using the reverse force method. for a restraint, you'd want to take controls without pass-through, and manually apply forces given the user's input. RR specifically also overrides the jump key to be just a short impulse, which gets around the need for a "stairs force" working against gravity.

minimal demo of that would be:

float speed = 1.75;
integer gNeededPerms;
default
{   state_entry()
    {   gNeededPerms = PERMISSION_TAKE_CONTROLS;
        llRequestPermissions(llGetOwner(),gNeededPerms);
    }
    attach(key ID)
    {   if(ID)
        {   llRequestPermissions(llGetOwner(),gNeededPerms);
        }
    }
    run_time_permissions(integer perm)
    {   if(perm& PERMISSION_TAKE_CONTROLS)
        {   llTakeControls(CONTROL_FWD|CONTROL_UP|CONTROL_BACK|CONTROL_LEFT|CONTROL_RIGHT,TRUE,FALSE);
        }
    }
    control(key ID, integer level,integer edge)
    {   if(level&edge&CONTROL_UP)
        {   llApplyImpulse(<0,0,0.75>,TRUE); // allows walking over small steps.
        }
        vector vel= speed*llVecNorm(
            <-1, 0,0.0>*!(level&CONTROL_FWD) +
            < 1, 0,0.0>*!(level&CONTROL_BACK)+
            < 0,-1,0.0>*!(level&CONTROL_LEFT)+
            < 0, 1,0.0>*!(level&CONTROL_RIGHT));
        vector v = llGetVel();
        vel.z = v.z; // allow falling while moving forward, causes problems if jump impulse is too high.
        llSetVelocity(vel, TRUE);
    }
}

 

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

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