Search Unity

Box Collider 2D keeps getting me stuck on blocks

Discussion in 'Physics' started by MrSanfrinsisco, Oct 6, 2019.

  1. MrSanfrinsisco

    MrSanfrinsisco

    Joined:
    Jan 17, 2018
    Posts:
    23
    I'm new in a way to creating games in Unity, I'm having an issue where if I hold my walk button into a block my character will not continue to fall. I'm pretty sure it's an issue with my box collider but I recorded a video showcasing my issue, I've added some debug messages so you know when I'm pressing and releasing buttons, and at the end I show my settings in my box collider. If you need anymore information please let me know, thank you!



    Edit: Forgot link
     
  2. berzii

    berzii

    Joined:
    Jun 25, 2016
    Posts:
    11
    Hi there,
    There is a simple solution for this. Just create a Physics Material 2D, set the friction of this material to 0 then add this material to the wolf's Rigidbody2D component.
     
  3. MrSanfrinsisco

    MrSanfrinsisco

    Joined:
    Jan 17, 2018
    Posts:
    23
    How do I create that? I tried creating an empty gameobject and searched for a 2d physics material component but I didn't see one. Where can I find this?
     
  4. berzii

    berzii

    Joined:
    Jun 25, 2016
    Posts:
    11
  5. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    1,966
    Of course without further information I cannot be sure but is friction isn't keeping you in the air; it's more likely that you're setting the velocity of the Rigidbody2D directly, stomping over the velocity accumulating via gravity. It looks like you fall when you stop movement.