cjddmut / Unity-2D-Platformer-Controller

A customizable 2D platformer motor that handles mechanics such as double jumps, wall jumps, and corner grabs. Includes a player controlled prefab that can be dropped into any scene for immediate support.
MIT License
873 stars 163 forks source link

There is a slight delay after pressing left/right key before character actually begins movement #59

Closed anchpop closed 7 years ago

anchpop commented 7 years ago

First, thanks for this wonderful controller! It's just programmed brilliantly, and should be simple to modify for what I need it to do. But I'm running into just one issue.

I'm just using the Basic Player Controller prefab. When I press left or right, the character does nothing for about a quarter of a second, then begins accelerating. Just tapping left/right does not result in the character moving at all, the key must be held for >.2 seconds (as far as I can tell). This even happens when Time to Ground Speed is set to zero.

Why is this and how can it be fixed?

anchpop commented 7 years ago

Sorry, I'm an idiot. This was being caused by line 71 in PlayerController2D.

(Mathf.Abs(Input.GetAxis(PC2D.Input.HORIZONTAL)) > PC2D.Globals.INPUT_THRESHOLD)

Lowering INPUT_THRESHOLD solved the issue. I'd consider changing this value to something around .02f so others don't get tripped up on this

AngryPowman commented 7 years ago

The same problem to me, is there any solutions for this issue?

anchpop commented 7 years ago

Yes. Lower PC2D.Globals.INPUT_THRESHOLD in PC2D/Scripts/Globals.cs to something like .02f