I have no clue what could be causing it. I’m using the new input system, it’s set up so it’s a Vector2 for movement. Can’t even figure out why sometimes it happens and sometimes it doesn’t - except that it only happens when running, not walking. Is this a bug?
It doesn’t happen when using keyboard.
I did that too. The only difference is that the keyboard is basically a bool and the controller has more control over the range 0 - 1 which is exactly what I want and is what should be expected
How do you feed the float in? Isn’t this a rounding problem? I mean if I understand you you’re feeding the bool with a float from the controller’s 0-1 vector, right?
How do you determinate to get a bool? Which is basically a 0 or 1.
I suspect it is rounding, because if you have higher value than .5f, then it will usually be treated as 1 (true) and when it drops below .5f will be treated 0 (false) so your transition fall-off can start?
But maybe I’m misunderstanding your entire problem. In that case sorry about that.
You can time-filter the keyboard boolean so that it has a gradual rise and fall time… it’s pretty easy.
keep a persistent value for the current input
read the current input from the keyboard
I use Lerp to lowpass filter it
use the persistent value for all your business decisions.
Vector3 PersistentMovement; // class variable
When processing your input:
Vector3 KeyboardInput = ... however you get the digital / boolean input here
PersistentMovement = Vector3.Lerp( PersistentMovement, KeyboardInput, Snappiness * Time.deltaTime);
Now wherever you would move the character, use PersistentMovement instead.
Larger Snappiness makes it … snappier. Smaller makes it less responsive: a super simple poor-mans one-sample history low pass filter.
You can do more with easing functions but it gets hairy and you start to have to assume things about the frequencies of the input signal.
When I said bool I meant that when you’re using keyboard there’s no mid point, you can’t just half-press a key, either you’re pressing it or you’re not. So the value for movement will always be either 0 or 1. With the controller you have the option to just go at 0.5 if you want, makes sense? Sorry if it made it a bit confusing, I didn’t mean an actual literal bool, the input system gives me a Vector2 (with 2 floats from 0 - 1).
This is cool, would make the keyboard better, thanks. But it doesn’t solve the problem, I’m looking to be able to use a controller.