Search Unity

Question Is there a way to prevent my character colliding with background?

Discussion in '2D' started by IgorArnaut, Apr 11, 2022.

  1. IgorArnaut

    IgorArnaut

    Joined:
    Nov 15, 2021
    Posts:
    39
    I wanted to make Cinemachine camera not go further than the Terrain, so I set Sky, which has a Composite Collider that uses Tilemap Collider, as a confiner. Player is in default layer and has a Box collider.

    When I start the game, Player collides with Sky and gets pushed off the ledge of Terrain. How do I prevent this from happening?

    https://imgur.com/a/Jd3uvtK
     
  2. karliss_coldwild

    karliss_coldwild

    Joined:
    Oct 1, 2020
    Posts:
    602
    In "Project Settings/Physics 2D" there is a table of checkboxes for which layers can collide with what. Place the collider you use for camera confinement in a separate layer and mark the checkboxes accordingly.
     
    The-Jackelope and Gregoryl like this.