Facepunch / sbox-issues

180 stars 12 forks source link

Add/Expose IsRunning Boolean to default player controller #7508

Open jusvit opened 1 week ago

jusvit commented 1 week ago

What can't you do?

Currently with the default player controller you can't see if it's running without doing some janky stuff.

How would you like it to work?

Image

Expose the boolean value so we can check if the controller is running like the others.

What have you tried?

I can get around it by checking the speed / checking if button is pressed, but it would make sense for a fundamental Boolean to be exposed.

Additional context

No response

Retroeer commented 1 week ago

imo, IsSprinting should be true if the player is actively running, not just holding the sprint button

jusvit commented 1 week ago

imo, IsSprinting should be true if the player is actively running, not just holding the sprint button

Agreed, even if you have run on by default.

Retroeer commented 1 week ago
    bool CheckSprint()
    {
        if ( DisableSprinting ) return false;
        if ( !Input.Down( "Run" ) ) return false;
        if ( Input.AnalogMove.x != 1 ) return false;
        if ( WishVelocity == Vector3.Zero ) return false;
        return true;
    }

I use this in my custom default controller, quite swell. Though this is tailored to my personal preference of only allowing sprinting while the player is atleast holding forward, rather than letting you sprint backwards/side-to-side