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

Question Why the rigidbody not falling when the body is in touch with collider?

Discussion in 'Physics' started by Shiina011, Sep 1, 2022.

  1. Shiina011

    Shiina011

    Joined:
    Oct 1, 2020
    Posts:
    46
    For a better understanding, here's the screenshot
    upload_2022-9-1_17-32-34.png

    At that position, I keep pressing D for movement to the right, so it's stuck at that position until I let go of the D key and the rigidbody falls. Maybe that's the problem, but what is the reasoning behind that?
    I'm using velocity for movement, here's the code
    upload_2022-9-1_17-35-33.png

    Is there a way to prevent this? If there are any discussions about this, it would be great to share the link here. Thank you!
     
  2. AlTheSlacker

    AlTheSlacker

    Joined:
    Jun 12, 2017
    Posts:
    326
  3. NarutoU21

    NarutoU21

    Joined:
    Sep 27, 2020
    Posts:
    13
    @Shiina011 this because of the friction between your player and wall, which is applied through rigidbody component. You are pressing d for right side movement and while pressing you are giving a continuous input to the player. Which overcome the rigidbody gravity and when you leave the D key now rigidbody will do its work.
    Create a physics material 2d and in that friction goes to 0 and if you want bounciness then it upto you . After that apply that material in player rigidbody material selection.
     
  4. Shiina011

    Shiina011

    Joined:
    Oct 1, 2020
    Posts:
    46
    Thanks both of you!
     
    AlTheSlacker likes this.