Search Unity

Resolved Help! Collisions Not Working At All

Discussion in 'Getting Started' started by PuddleCat, Jul 20, 2022.

  1. PuddleCat

    PuddleCat

    Joined:
    Jul 20, 2022
    Posts:
    6
    I'm making a 2D game on Unity and I put colliders on both the Player and the Object I want it to collide with. All I want at the moment is for the player to not be able to walk through it, but it still does this. All the tutorials I watched seem to not have this issue. I have attached pictures of all relevant menus and happenings. Screen Shot 2022-07-19 at 9.05.45 PM.png This is the Player character, you can see the collider. Screen Shot 2022-07-19 at 9.05.54 PM.png The Player character's settings, you can see that I have a collider. Screen Shot 2022-07-19 at 9.06.02 PM.png These are the settings on the Nursery, which is the Object I want to not go through. Screen Shot 2022-07-19 at 9.05.37 PM.png However, as you can see, the Player goes through the Nursery despite the colliders I put. I'm completely at a loss for what to do about this, please advise.
     
  2. lavagoatGG

    lavagoatGG

    Joined:
    Apr 16, 2022
    Posts:
    229
    you need rigidBody component attached to the nursery for it to work
     
  3. PuddleCat

    PuddleCat

    Joined:
    Jul 20, 2022
    Posts:
    6
    I just did so. It still does not work. You can view this in the image: Screen Shot 2022-07-19 at 11.31.32 PM.png
     
  4. lavagoatGG

    lavagoatGG

    Joined:
    Apr 16, 2022
    Posts:
    229
    Change the body type on both to dynamic, and gravity scale to 0
     
  5. PuddleCat

    PuddleCat

    Joined:
    Jul 20, 2022
    Posts:
    6
    I just tried this, and it worked! I also had to freeze the nursery in position, because my first test had it flying off the screen to who-knows-where, LOL. Thank you very much for your assistance.
     
    lavagoatGG likes this.