0 votes

Hi, I want to add shadows in my 2.5D game but the LightOccluder2D draws a shadow also on my character... How can I avoid this behaviour? Maybe with Light Masks? How can I use them?

Example in video:
https://youtu.be/k9nHyTWbCEI

Edit:
Solution was quite simple: assign different light masks to the occluder and sprite, then assign both light masks to the light! Now both receive light but shadow do not affect sprite

Second problem (optional) :
Now a character can't cast a shadow on an other character due to different light masks.. (lol) how can I resolve this little problem?

asked May 6, 2018 in Engine by lollornr (56 points)
edited May 8, 2018 by lollornr

1 Answer

0 votes

The OccluderPolygon2D has a variable called closed. Set it false. There might be something weird happening to the occluded. To fix that, just make one more point and put very close to the first one to close the loop. If you still want the polygon or sprite within the occluder to be affected by the light, then set CullMode to the direction you added the points to begin with.

answered May 6, 2018 by SIsilicon (3,779 points)

Thank you for the reply but unfortunately this did not worked!

What? What happened? It worked for me.

As you can see in the video the occluder doesn't cover the entire sprite but only its feet! So setting close to false partially resolve only a fraction of the sprite!

Can't really watch the video right now. I am not on broadband WiFi.
But did you 'close' the occluder? It will look like light Is leaking in otherwise. Like I said. Make another point in it and put close to first. Did you do that?

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.