Godot Version
4.7.2
Question
I’m making a 2D game where the player has a flashlight. I want enemies to be invisible outside of that flashlight. I have succeeded in that. The issue is, they become visible, even through walls. I already verified that my TileSet blocks the correct layers (1 & 2). The TileSet blocks the light from hitting the enemies, so they end up visible but darker as they’re in shadow until they come around the wall.
I’ve already verified:
- Enemies have
Light MaskandVisibility Layerset toLayer 2 - Flashlight has
Range → Item Cull MaskonLayer 1andLayer 2 - Flashlight has
Shadow → Item Cull MaskonLayer 1andLayer 2 - TileSet has an Occlusion Layer with
Light MaskonLayer 1andLayer 2 - TileMapLayer has
Occlusion Enabledturned on.
I can’t find any way to prevent the enemies from becoming visible through the wall short of raycasting every enemy within a given radius and manually flipping visibility if they’re behind a wall.