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

That little step... #37

Closed jsnetors closed 9 years ago

jsnetors commented 9 years ago

Whenever you jump in a direction and lands on a platform, the player does a little step forward before stopping. This is really bad for precision platforming and should be possible to disable... Pretty please?

cjddmut commented 9 years ago

This may be tied to having a deceleration of speed when stopping. Try setting ground stop distance to 0 and see if it resolves the issue. If it doesn't then it's a bug.

jsnetors commented 9 years ago

Ive tried dealing with the ground stop distance but it did nothing, control doesn't get more or less tight. I noticed that the longer you keep the direction you want to jump pressed, the longer is the after-lading step. Maybe there's something there.

cjddmut commented 9 years ago

Another thing to pay attention to is that if you're using the default controller script it uses Input.GetAxis("Horizontal") to get the button/joystick press amount. If the button is unpressed or the joystick set back to neutral then Unity will deceleration towards 0 over some period of time. Try updating the controller script to using Input.GetRawAxis instead.

From the FAQ:

I let go of the joystick and my GameObject isn't sliding the distance it is supposed to! If you're using the supplied PlayerController2D script or one of your own in which you use Input.GetAxis() then there's a built in deceleration in what Input.GetAxis() returns. This can definitely be impacting the distance the GameObject skids to a stop! To see a true skid to stop, set normalizedXMovement to zero.

jsnetors commented 9 years ago

Changed horizontal movement setting to getaxisraw and it fixed the issue, tho it no longer jumps in archs but actually drops straight after I let go of the horizontal key. Anyway, it's a satisfactory improvement!

cjddmut commented 9 years ago

You can fix that issue by changing the air stop distance to something greater than zero (that's used to calculate the air deceleration).