|Topic was automatically imported from the old Question2Answer platform.
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:
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?
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.
Thank you for the reply but unfortunately this did not worked!
lollornr | 2018-05-08 10:00
What? What happened? It worked for me.
SIsilicon | 2018-05-08 15:29
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!
lollornr | 2018-05-08 16:07
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?
SIsilicon | 2018-05-08 17:20