Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Character is slower on the ground

Discussion in '2D' started by Goyang_GG, Dec 5, 2020.

  1. Goyang_GG

    Goyang_GG

    Joined:
    Dec 5, 2020
    Posts:
    2
    Hello everyone,
    I'm currently developing a simple 2D Platformer. It contains:
    • Player
    • Ground Hitbox
    • Assets for Player and Ground
    I set the player Movement speed with GetAxis and AddForce and It works well. The problem is, that once I jump and move the character is moving faster then when just running on the ground. There is a certain drag / friction on the ground which makes it harder to move.

    My goal is to make the caracter move at the same speed when running on the ground as it is when running while in the air. Also I want to keep friction on the ground so that the players slowly stops moving on its own when the player doesn't input any movement.
    Any help is appreciated. Thanks!
     
  2. adehm

    adehm

    Joined:
    May 3, 2017
    Posts:
    369
    Does the ground have a physics material? Does that material have friction?
     
  3. Goyang_GG

    Goyang_GG

    Joined:
    Dec 5, 2020
    Posts:
    2
    I added Friction with the value 0.1 to the ground. This makes the character stop when the player doesn't input movement but also means that the character is slower on the ground than jumping + moving, which is behavior I don't want.
     
  4. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,637
    @Goyang_GG

    Well if you need non-physics movement, then maybe set the velocity directly? Instead of allowing physics system to do its thing.

    Or like already mentioned by @adehm, are you using friction? You could remove the friction. You can also stop the character by modifying its velocity when there is no input.