Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

triggers hide light flares when using physics 2d

Discussion in '2017.1 Beta' started by laurentlavigne, May 16, 2017.

  1. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,223
    case # 911429
    regardless of layer and physics settings
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,321
    This isn't a helpful post at all nor is the bug case you submitted that has no information in it. What has light flares got to do with 2D physics? Also, the bug was reported again 5.6.0f3. This is the 2017.1beta forum.
     
  3. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,223
    It's related with physics3d: Lens flare uses colliders to detect occlusion, and the bug is that it ignores the trigger flag.
    physics2d has the other bug that flares aren't occluded at all even with colliders. Bugs logged in 4.6 but still exist in 2017
     
  4. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,321
    2D physics has nothing to do with lens flares, nor has it ever intended to do so AFAIK. I am not aware of a 4.6 bug report that was reported for this either.

    I had a quick look through the code for Lens Flare (which isn't my area) and it's using a standard 3D ray-cast that will only contact triggers if Physics.queriesHitTriggers is true.

    That can be changed to also use the Physics2D.GetRayIntersection for pseudo 3D but I've never seem a request for that, maybe it was put to the team in charge of the camera, not sure.
     
    Last edited: May 17, 2017
  5. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,223
    That'd be very useful. As old as lens flare is it does the job well and consistency between 2D and 3D is always welcome. I for one thought I could transpose what I knew of lensflare to 2D. I can add collider 3d just for lense flare in the meantime, thanks for checking.
    Querries hit triggers was on, I wonder if it was on by default or I set and forgot about it ages ago.
     
  6. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,321
    The dev who's in charge of Lens flare got in touch with me about this. We can add 2D as it's just adding in the "Physics2D.GetRayIntersection" call. It'd probably need to check both i.e. check 3D ray then 2D ray rather than adding a specific option for 2D or 3D but the dev in charge will make that decision.

    Anyway, sounds like you got it working for now.
     
  7. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,223
    That's great news, thanks.
     
  8. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,281
    I've looked at this bug today.

    Seems like the bug reports one thing (triggers), but you are raising 2 different issues in this forum post (triggers and 2D).

    Regarding the triggers:
    They are controllable via Edit / Project Settings / Physics. There is a checkbox to make Raycasts ignore triggers. Seems like you found this already though, judging by your more recent post here.

    Regarding the 2D support:
    I have added it. It will be available in a future release.

    Thanks for raising the issue.
     
    MelvMay and mahdi_jeddi like this.