Ghost Mansion: How to prevent light going through walls?

Right now, the flashlight lights up the inside of a room if you’re standing outside pointing at a room.
Is there any way to prevent the flashlight from shining through walls?

Yes!
It’s a bit (lot) of a pain and rearrangement but possible

The gist can be seen here but I didnt finish it off properly

Hint - 2d lights can be set to light certain layers…

{PS can you put the Quest Name in the title if/when the tags are not showing (known issue with the boards if you thought the tags were there)}

1 Like

How did you get the light to scale?!

@Hazel_Ryan I adjusted the lights outer radius and localscale

Thanks! I tried to use the sorting layer, but there’s a whole bunch of problems there.
I noticed with your implementation that you’re keeping track of the player location, so for now, you cannot shine a flashlight into or out of the doorways unless you cross that threshold.

I was hoping for an easy “switch” to set the walls/foreground to block the light using a collider or something straightforward. I guess not :frowning:

Correct - which is why I put a ‘door’ across most of the gaps.
But quickly implemented and would need tweaking to look a bit better in that area

The walls were relatively easy but the light would still shine in the room behind the wall until (a lot) more was done…

2 Likes

Privacy & Terms