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

Character gets stuck on tile edges. How to fix this without using composite collider?

Discussion in '2D' started by Gabrysiek, Jun 11, 2020.

  1. Gabrysiek

    Gabrysiek

    Joined:
    Nov 26, 2017
    Posts:
    4
    Hello, I've been developing a platforming game with random terrain generation. The issue I'm facing is that my character bumps tile edges or gets stuck on them completely. I've tried using composite collider, but as I figured it severely affects the game's performance. Whenever a chunk generates or gets loaded, it seems to update the whole tilemap freezing the program for a moment.
    What are my options to fix this and how to go about them?
     
  2. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068
    Sorry, we are looking into an issue with performance with the TilemapCollider2D and the CompositeCollider2D. A potential fix should be available in 2019.4.1f1, where performance could be increased by setting the "Offset Distance" property of the CompositeCollider2D to 0.

    In the meantime, could you share the settings for your TilemapCollider2D, your CompositeCollider2D and the version of the Unity Editor you are using? Screenshots from the Inspector would be helpful! Also, if you can and comfortable to do so, do set your Inspector to Debug mode and share the approximate number of Composite Paths and items inside each one? This would be helpful in identifying the scale of the issue here. Thanks!
     
  3. Gabrysiek

    Gabrysiek

    Joined:
    Nov 26, 2017
    Posts:
    4
    Hello, thanks a lot for reply! Would you mind to tell me when it's going to come out? Right now, I'm using Unity 2019.3.5f1.
    Here are the settings. Pretty much left on default.
    upload_2020-6-12_11-17-18.png
    upload_2020-6-12_11-17-49.png
    upload_2020-6-12_11-18-24.png
     
  4. DiegoperezB

    DiegoperezB

    Joined:
    Nov 7, 2018
    Posts:
    1
    Hi.
    I know this is an old thread but, if someone still have this problem, what worked for me was setting the 'Vertex distance' and the 'Edge Radius' to 0 in the Composite Collider 2D. I hope this can help somebody.
     
  5. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,623
    No adjustments or tweaks whatsoever will make this go away, only potentially reduce it such as using a CapsuleCollider2D for your character for instance. Collisions happen on a per-shape vs per-shape bases so shapes next to each other such as polygon boxes don't form a continuous surface so you can catch the sides of adjacent shapes.

    The 2D physics engine can form continuous surfaces in one way only; by producing continuous edges. Continuous edges can be created either via the EdgeCollider2D or the CompositeCollider2D in Outline mode (which produces continuous edge).