case # 911429
regardless of layer and physics settings
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.
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
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.
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.
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.
That’s great news, thanks.
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.