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

PlatformEffector2D::colliderMask

Discussion in '2D' started by Manny Calavera, Mar 14, 2015.

  1. Manny Calavera

    Manny Calavera

    Joined:
    Oct 19, 2011
    Posts:
    205
    Unity 5 implemented the PlatformEffector2D which helps in dealing with side friction. Cheers to that!

    However, this component has a colliderMask property that completely overrides the settings of the layer mask of that object. Is there a way to avoid that?

    If not, I'm considering writing an editor script that will find all Platform Effectors in the scene and 'fix' the colliderMask by looking up the gameObject's layer and copying the corresponding collision matrix into the colliderMask. I suppose I'll have to call Physics2D.GetIgnoreLayerCollision() for each layer and stamp that on the PlatformEffector::colliderMask. Unless there is a better way? Like, for a given layer, is the collision mask already available somewhere?
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,417
    Yeah, we were wondering if this might be an issue for some. Early-on we made the decision that having a per-effector mask was extremely useful and during the alpha/beta cycle, nobody found this an issue. Indeed, this is the very first time I've seen anyone mention it.

    It has kind of been in the back of my mind that we should add the option in all effectors whether to use the collider-mask or the 'global' one. I guess that would solve your problem right?
     
    theANMATOR2b and Manny Calavera like this.
  3. Manny Calavera

    Manny Calavera

    Joined:
    Oct 19, 2011
    Posts:
    205
    Right. An option to honor the global collision layer matrix would be great.

    In fact, when I first read the 'collider mask' I assumed it would do a bitwise operation against the global settings but reading the docs it mentioned it overrides it. Just a feedback on the name.

    Thanks for dropping by!
     
    theANMATOR2b likes this.
  4. kernjiro

    kernjiro

    Joined:
    Apr 5, 2014
    Posts:
    3
    I'm having the same problem trying to get my players to drop through platforms again.