Search Unity

How do I make it so my character doesn't fall through the floor?

Discussion in 'Physics' started by bhallman, Mar 14, 2019 at 10:30 AM.

  1. bhallman

    bhallman

    Joined:
    Thursday
    Posts:
    1
    I'm COMPLETELY NEW TO UNITY and I'm trying to make my character in a 2D game stop from falling through the floor. Here's what it currently looks like:
    upload_2019-3-14_13-27-20.png

    Whenever I press start the rigidbody on the character which makes it fall through the floor.
    What collider should I use, and how do I rig it?
    Or should I use a collider at all?
     
  2. superdupergc

    superdupergc

    Joined:
    Jun 21, 2013
    Posts:
    17
    You definitely need some sort of collider to provide the physics check to see if it should collide with the floor. I'm not really a 2d person, but some sort of 2d collider that approximates the shape of your character is probably best. Maybe try BoxCollider2D as a start?

    Or use a character controller - that would include movement stuff and the collider in one thing: https://unity3d.com/learn/tutorials/topics/2d-game-creation/2d-character-controllers