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

Question Subtract top layer collision from bottom layer collision

Discussion in '2D' started by MJRamonio, Aug 26, 2023.

  1. MJRamonio

    MJRamonio

    Joined:
    Aug 22, 2023
    Posts:
    4
    Trivial task, Googled nothing close to this. So I have one tilemap layer "hills" with hills that have collisions (drawn with RuleTile). And then I have another tilemap layer "slopes" on top of it with slopes tiles. How can I subtract collision of "slopes" layer from "hills" layer?





    Note: It has to be done this way (or similar) because of RuleTile usage. Hills are drawn like that (and other terrain) to avoid manual placement. Thanks!
    .
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,563
    Not sure what you mean by "subtract" but generally these types of things are implemented simply as there is no collider there on the slope. That's how things like Legend of Zelda seem to work.
     
  3. MJRamonio

    MJRamonio

    Joined:
    Aug 22, 2023
    Posts:
    4
    Yet you missed "RuleTile" part :)
    Managed to solve it with dynamic script that disables collision for tiles beneath slopes.
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,563
    Until I understand how you "subtract collisions," there's no point even trying to consider the post further. :)

    Glad you're up and going.