https://playground.babylonjs.com/#TQ67L1#11
The lens flare is visible behind the box even if isBlocker
is set to true. However, it works as expected only when the mesh is assigned a material to it. You can test it out in the playground link I pasted above. The line 37 adds a material to the mesh, which is commented.
Yes, having a material is a requirement as explained in the doc (Lens Flares | Babylon.js Documentation):
Babylon.js can also detect occlusions for you. A mesh can occlude the lens flares if the following conditions are met:
- has a material
- isVisible === true
- isEnabled() === true
- isBlocker === true
5 Likes