Search Unity

2D Particle system colliding with 2D Triggers, Why & How do I fix?

Discussion in 'Physics' started by darkAbacus247, Jun 28, 2016.

  1. darkAbacus247

    darkAbacus247

    Joined:
    Sep 7, 2010
    Posts:
    251
    I have a particle system set for 2D environments (top left img), works just fine but collides with 2D triggers (btm left), What am I doing wrong?

    here's a quick jpg... Untitled.png
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,424
    You show a CircleCollider2D but point to a box-like shape. Something is not correct for sure. ;)
     
  3. darkAbacus247

    darkAbacus247

    Joined:
    Sep 7, 2010
    Posts:
    251
    That's my bad, just pretend like that said box collider. I simply pasted the wrong image into that example.

    The image should actually show the particle system shooting particles through the rectangle (in which would correctly contain a box collider). Instead when the particles contact the box collider (rectangle) they bounce off even though the rectangles collider has been set as a trigger.

    regardless of my obviously silly mistake, any ideas on what may be the reason behind particles bouncing off a trigger collider? Any suggestions would be greatly appreciated. Thanks all!
     
  4. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,424
    I'll check with the particle system guys but I suspect it's using a circle-cast and is affected by QueriesHitTriggers. If you turn-off that option, does it then stop contacting triggers?
     
  5. darkAbacus247

    darkAbacus247

    Joined:
    Sep 7, 2010
    Posts:
    251
    Hey thanks again for your help! I've followed your suggestion and placed this a start function...

    Code (CSharp):
    1. Physics2D.queriesHitTriggers = false;
    Curious to know though, will doing this cause any unseen issues somewhere's else? I'm not horribly familiar with 'Physics2D.queriesHitTriggers', checked out the Scripting API...though I don't fully grasp it :/

    Also, this can be placed in any script in scene, even if not related to particle system or collider, is this a global variable then?

    Either way, thanks a bunch!
     
  6. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,424
    If you're performing queries i.e. ray/line-casts, overlapXXX (etc) and you want them to return colliders that are triggers then this needs to be on. If you're not doing that and are only interested in non-triggers for such calls (or are not using such calls) then you should leave it off. At some point, a per-call option of this will be available allowing this kind of option to be removed globally (or at least be used to set the overridable default).

    Because it's a global project-wide setting, you're better off just going into the Physics2D settings and turning it off there perhaps.

    I had thought it was off by default but I'd need to double-check that so perhaps you turned it on somewhere along the line.
     
    darkAbacus247 likes this.
  7. TimNedvyga

    TimNedvyga

    Joined:
    May 18, 2015
    Posts:
    95
    In 2018.1.7f1 & 2018.2.0f1 Unity fixed this bug, but here's the deal, I used this "bug" to do pretty much half of my game mechanics
    upload_2018-7-7_15-53-27.jpeg

    Is there a way to get this behavior again?
    @MelvMay Could you help me?
     
    Last edited: Jul 7, 2018
  8. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,424
    Not really, it was a bug and both 2D/3D needed to work in the same way. The only way to get the behaviour again is to unfix the bug in the paritcle system.