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. Dismiss Notice

Bug Player Visually Not touching the ground

Discussion in '2D' started by Unfinished_, Jul 7, 2023.

  1. Unfinished_

    Unfinished_

    Joined:
    Jan 26, 2023
    Posts:
    5
    upload_2023-7-7_21-54-54.png
    The player isn't falling through the ground, both of them have box collider 2d at their size. I am using pixel perfect camera, the size of the player sprite is 32x32 and the pixels per unit for both the sprite and the pixel perfect camera is 32. Everything about the player movement is working properly.
     
  2. venediklee

    venediklee

    Joined:
    Jul 24, 2017
    Posts:
    143
    Wild guess: is gravity enabled on the rigidbody2D of player?
     
  3. TomTheMan59

    TomTheMan59

    Joined:
    Mar 8, 2021
    Posts:
    298
    Just make the box collider offset from the feet and it will work
     
  4. Unfinished_

    Unfinished_

    Joined:
    Jan 26, 2023
    Posts:
    5
    Yes, the gravity is enabled. As i said the player movement works properly and the player movement wouldn't work properly if the player was floating
     
  5. Unfinished_

    Unfinished_

    Joined:
    Jan 26, 2023
    Posts:
    5
    I already did that as a temporary solution but it doesnt solve the actual problem
     
  6. venediklee

    venediklee

    Joined:
    Jul 24, 2017
    Posts:
    143
    Sorry, there was nothing about rigidbody in your original post, also movement can "work" without gravity

    Some things to consider:
    If the space is only there in the game view but not the scene view, snap both of the objects with the grid snapping tool. The grid size is 1/ppu, in your case it'll be 1/32
    Create a empty box with just box collider2d and rigidbody2d and drop it from up high to see if it behaves the same
    Try different settings on the rigidbody2d
     
  7. Chubzdoomer

    Chubzdoomer

    Joined:
    Sep 27, 2014
    Posts:
    105
    See MelvMay's responses here and here.
     
    MelvMay likes this.
  8. TomTheMan59

    TomTheMan59

    Joined:
    Mar 8, 2021
    Posts:
    298
    What was the issue? It's the exact solution Mr. May said in the first "here".