Search Unity

Tilemap Collider 2D (Fail Shake)

Discussion in '2D' started by Juandapp, Nov 21, 2019.

  1. Juandapp

    Juandapp

    Joined:
    May 11, 2016
    Posts:
    53
    Hello everyone,

    What is the best practice for my TileMap collision Pixel Art Horizontal Platforme?

    I am using a 2D Tilemap Collider for my ground, however it has a lot of shake, my character seems to be on uncovered ground and does not walk smoothly. I have been told to change the collider and place an Edge or a Box, but that complicates things, because I have to accommodate a box or colider to all my grounds. Why does that happen ?, Then Tilemap Collider 2D is not made for ground ?. I try to make a horizontal platform video game and my character seems to bite some bug once in a while, because suddenly a little. (Pixel Art 16 and 32px- Horizontal Platform).

    Thank you in advance.
     
  2. blu3drag0n

    blu3drag0n

    Joined:
    Nov 9, 2018
    Posts:
    94
    I assume you use the automatically generated physics shapes for your spritesheets, which is why you might have some sort of shaking movement.
    Please check your physics shape outlines, you can do that by checking on the imported spritesheet, click on Sprite Editor and then on the upper-left corner you can just chose "Customer Physics Shape" in the dropdown, where every tile is clickable afterwards and will show you its automatically generated physics shaped which is used in the TilemapCollider2D module.

    Furthermore I assume you are missing the "CompositeCollider2D" component on your Tilemap where you have the TilemapCollider2D.

    And to finalize all these assumptions:
    if you would have provided more information about what you are doing and how you are doing it, then nobody of us needs to just assume things ;-)
    So please provide some more details or screeshots of your used components and of your arts.
    I mean, how do you accept help about a question "Why is my picture no working as I need it ?" when you don't even show us the picture :)
    No offense, but please try to get the POV of all us helpers :p

    KR
    blu3
     
  3. Juandapp

    Juandapp

    Joined:
    May 11, 2016
    Posts:
    53
    That doesn't offend me, you're right, sometimes everyone is supposed to guess what we do, but it's wrong, it's always better to give an example and that's why I leave a video to specifically see what I mean. Sorry for my English, it's not my mother tongue.

    I'm going to try what he said before, and I'll see if what you said is the answer to my problem, hehehe. Thank you

     
    Last edited: Nov 22, 2019
  4. Juandapp

    Juandapp

    Joined:
    May 11, 2016
    Posts:
    53
    I tried all your recommendations. but I had no positive results :(

    upload_2019-11-22_15-10-13.png

    upload_2019-11-22_15-10-49.png

    upload_2019-11-22_15-53-25.png
     

    Attached Files:

  5. blu3drag0n

    blu3drag0n

    Joined:
    Nov 9, 2018
    Posts:
    94
    Thanks for providing more information, that helped.
    And as I was guessing: you are still missing the CompositeCollider2D component on your Tilemap.
    It's another / extra component, that needs to be added.
    Then as you've already did, just check the checkbox "used by Composite" on your TilemapCollider2D component :)

    Furthermore check with GIMP or whatever tool that you really have the most top-left and most top-right pixel of the corner/border (that middle tile from your picture screenshot) that they are at the same height, so that they perfectly match if arranging multiple of those next to each other.
     
    Juandapp likes this.
  6. Juandapp

    Juandapp

    Joined:
    May 11, 2016
    Posts:
    53
    I didn't know how to use CompositeCollider2D, but after test and error, I managed to do it, and now it works perfect. Many, thank you very much.