Search Unity

Question Any way to area mask colliders?

Discussion in '2D' started by lordumbilical, Dec 28, 2022.

  1. lordumbilical

    lordumbilical

    Joined:
    May 24, 2020
    Posts:
    38
    I have a door that I want to plug into a wall. The door's sprite mask makes the wall beneath it disappear as the door opens, but of course the wall collider keeps blocking the player. I can't disable the entire wall; I just want to somehow smother the wall collider from being active in that specific door area. So far, there is no obvious way as far as I can tell, apart from setting up a trigger to activate/deactivate the wall collider when stepping in the specific area, but I'd much rather have something like a collider mask, if it exists.

    Any ideas?
    Much appreciated.
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,459
    No, that doesn't exist yet. If your wall was composed of separate colliders that were joined with the CompositeCollider2D then you'd be able to remove the collider.

    Although it won't help you now, In 2023.1 there are composite operations that allow you to perform AND/OR/NOT/XOR operations so you could add a collider with a NOT operation to remove it: https://twitter.com/melvmay/status/1593687762506481666?s=20&t=hnaKhRnQoE-Y_B393B-gLA
     
    MousePods likes this.
  3. lordumbilical

    lordumbilical

    Joined:
    May 24, 2020
    Posts:
    38
    Thanks so much. The new composite operations sound very handy indeed. Ive used a trigger and some invisible blocking objects for the time being, just to turn off the entire wall and shepherd the player through the door space. Its not elegant, but it gets the job done for now.
     
    MelvMay likes this.