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?

in Engine by (56 points)
edited by

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.

by (3,926 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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.