Search Unity

Player pushed upwards by collider for some reason

Discussion in 'Physics' started by CaptainAfrica, Aug 5, 2019.

  1. CaptainAfrica

    CaptainAfrica

    Joined:
    Aug 5, 2019
    Posts:
    5
    Posted in wrong forum perhaps, but in any case:

    Hi guys I am very new to Unity and picking up the basics. Not sure if this is a newbie problem or mistake.

    Going through Jared Halpern's Developing 2D Games with Unity tutorial. Player first does not collide with background objects, and I think it is the issue of the box collider as I followed instructions (Ch. 1-4) to create colliders with the background objects. I then try to make it bigger like around .0025 so the collider is "big enough", she gets pushed up to the top of the map and I cannot move downwards. When I read in the tutorial the author did not want more editing of the box collider to this point. Video attached for further details.

     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    1,966
    Sounds like you're colliding with background colliders. You can assign a GameObject to a layer and control which layers can contact which other layers in the physics settings (go to Project Settings and look at Physics 2D and you'll see the collision matrix which allows you to control this.

    A overview you could look at is here.
     
    CaptainAfrica likes this.
  3. CaptainAfrica

    CaptainAfrica

    Joined:
    Aug 5, 2019
    Posts:
    5
    Thanks for the help! I unchecked "default" with "blocking" and "object" layers. The colliders are now working although it's slipping a bit.
     
  4. bowserscastle

    bowserscastle

    Joined:
    Jul 9, 2017
    Posts:
    12
    To anyone reading this - I've responded to the above question here.