Search Unity

2D collider mask

Discussion in '2D' started by RyFridge, Jun 18, 2015.

  1. RyFridge

    RyFridge

    Joined:
    Apr 7, 2014
    Posts:
    52
    Hey everyone,
    I have a seemingly complicated collider problem. Hope the figures below describe it well enough:

    collision01.jpg
    BLACK = Player, using Rigidbody2D and some kind of movement controller.
    RED = Different colliders, like platforms.
    YELLOW = Area in which the background collider should not apply, effectively somehow masking it.

    collision02.jpg
    Hitting PLAY: The player is falling down due to the laws of physics. The problem: He will bounce into the invisible background platform.

    collision03.jpg
    GREEN = Position where I'd like to have my block collide.

    So, I thought about a few approaches, but none seems to be the right way to do it:
    - Physics2D layers
    - RenderTexture for colorcheck
    - activating background collider on leaving the yellow box

    It must be scalable to like multiple (yellow) cells of different shapes and still work...

    Every idea is welcome! This must be solvable somehow?
    RyFridge
     
    GameBuddy105 and ethunt703 like this.
  2. RyFridge

    RyFridge

    Joined:
    Apr 7, 2014
    Posts:
    52
    Bumping, I hope it's okay.

    There must be someone here who has encountered such a problem? It seems like it would occur from time to time..

    Maybe I could like emulate a second layer of script generated edge colliders every frame? Is that viable?

    EDIT: If anyone is interested, I set this up for now, already mostly working. Next step is creating the PolygonCollider2D and the Plane (Mesh).

    ColliderTest.png
     
    Last edited: Jun 24, 2015
    asdf49514, nhftk and GameBuddy105 like this.
  3. abitofjohn

    abitofjohn

    Joined:
    Nov 6, 2012
    Posts:
    27
    This is exactly what I'm looking for, any tips for how you achieved this?

    Thanks
     
  4. GameBuddy105

    GameBuddy105

    Joined:
    Jul 23, 2017
    Posts:
    1
    Yooo!!! I've been lookin for exactly this for a while now, surprising how little there is on it
    did you ever get the polygon collider working as the final shape?
    if so, I'd love to maybe see some of the references you used while creating it
    or maybe a link to a usable asset version of this, if it exists