I wanna make Light2D appear behind certain objects. Is it possible? If yes, then how?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Montasir Raihan

Hello everyone, I’m working on a top down 2d game where the player uses a cone shaped flashlight. And there’s a CanvasModulate node to make the environment dark. The player can shoot rockets and grenades and as soon as they explode fire and smokes appear. I made those fire and smokes by using Particles2D. Everything’s working fine. But I noticed when the player is too close to the explosion the light effects the smokes and fire and it looks weird. I don’t want that. I don’t want the light affect the smokes. I want it appear behind the smokes and fire where I can’t see the light until the smokes disappear. I’ve searched on Google and tried to find solutions on YouTube. But nothing works. Which got me thinking, is this achievable? If yes then how? If no then is there any other way I can achieve the same result that I want?

Any kind of help will be appreciated. Thank you in advance.

:bust_in_silhouette: Reply From: Karprog

Maybe you could put your fire and smoke objects on another layer. Then in Light2D you can set the layers, that are effected by your light.

Thanks. I’ll see if it works.

Montasir Raihan | 2022-11-05 05:18