Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  4. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  5. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

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

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

  1. globenorth

    globenorth

    Joined:
    Sep 7, 2010
    Posts:
    215
    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:
    1,397
    You show a CircleCollider2D but point to a box-like shape. Something is not correct for sure. ;)
     
  3. globenorth

    globenorth

    Joined:
    Sep 7, 2010
    Posts:
    215
    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:
    1,397
    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. globenorth

    globenorth

    Joined:
    Sep 7, 2010
    Posts:
    215
    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:
    1,397
    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.
     
    globenorth likes this.
  7. TimNedvyga

    TimNedvyga

    Joined:
    May 18, 2015
    Posts:
    44
    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:
    1,397
    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.