Search Unity

2d character falling through ground, and bouncing a little

Discussion in 'Physics' started by Bakczki, May 13, 2018.

Thread Status:
Not open for further replies.
  1. Bakczki

    Bakczki

    Joined:
    Aug 19, 2014
    Posts:
    1
    I have simple character with rigidbody and 2d box collider attached and tiles with applied tilemapcollider 2d. How to prevent character from falling through tiles sometimes? Falling occurs not only on tilemap collider but other sprites with attached colliders. In addition player collider falls into tiles collider and moves back on top of the tiles. On rigidbody i have applied continuous collision detection, interpolation, but changing to other option doesn't make much effect.

     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,459
    Interpolation has nothing to do with physics and won't affect it, it's purely a rendering thing as it modifies the Transform only between physics updates. Continuous collision should not allow this and I've not seen it fail.

    Ensure that the Animator isn't modifying the Transform in any way. It'd be interesting to know what collision shapes the TilemapCollider2D is using.

    If you still feel this is a bug then please submit a bug report so we can investigate.

    Thanks.
     
    Overlord_Senpai likes this.
  3. dormamu

    dormamu

    Joined:
    Jul 11, 2019
    Posts:
    1
    yea a similar thing has been happening with my project as well. Player character seems to fall through tiles when landing between 2 tiles at a velocity of around -20 in y axis. my character is using a capsule collider 2d and the tile has been set to use the collision type as Grid.Collision Detection was set to Discrete
     
  4. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,459
    The only details that matter are that you're using Discrete on a fast moving (20 m/s) body so depending on the sizes of the colliders involved, you can easily step over colliders. This is why continuous should be used for fast moving stuff but it's more expensive to calculate the exact poing of collision so should be only used where needed.
     
  5. Daevilsbad

    Daevilsbad

    Joined:
    Nov 21, 2020
    Posts:
    1
    I have the same problem when I use high jump power. Is there a way to have high jump power and make the colliders(Tilemap/Composite) of the platform nevertheless working?
     
  6. mozikr

    mozikr

    Joined:
    Nov 10, 2019
    Posts:
    1
    I had a similar problem and in my case changing the colision detection to "continouse" helped.
     
    Overlord_Senpai likes this.
  7. Overlord_Senpai

    Overlord_Senpai

    Joined:
    Oct 8, 2018
    Posts:
    1
    This worked
     
Thread Status:
Not open for further replies.