im trying to make a lighting system for my 2d game, but the shadows from the 2d light node look really weird on the upper left tiles
lighting problem
cogosod4 but the shadows from the 2d light node look really weird on the upper left tiles
might want to include a screenshot at the very least for us to have a better idea of what that even means.
Megalomaniak sorry i forgot to do that
These black areas are holes? And do you have any occluders set up in the scene?
https://docs.godotengine.org/en/stable/tutorials/2d/2d_lights_and_shadows.html
Megalomaniak yes the black parts are holes, and yes, the tileset is an occluder
cogosod4 and yes, the tileset is an occluder
The whole tileset? I think that's your problem.
Megalomaniak no just the blocks
Ah I see it now, I initially interpreted it as being top down and the tiles being the floor. With that confusion out of the way the issue in the first screenshot is that your character is colliding/intersecting with the blocks/corner in such a way the light caster is embedded in that corner. You might want to increase you characters collision shape size a bit so that couldn't happen.
Megalomaniak ooh ok tysm
Megalomaniak it didnt work
Maybe try adding a small sprite that is just a few pixels in size (like a 2x2
square) as a child node of your Light2D, positioned where the center of the square is the center of the Light2D. Then you should be able to "see" the Light2D node center attached to the character, and then visually see if the center of the 2x2 sprite (which should be fully visible) clips into the black/dark tiles, which would mean the Light2D clips into the black/dark tiles. If it does, then you will either need to further increase the collision shape around the player, or add some code so that when the player is nearby tiles, it pushes the Light2D node away slightly so it does not clip inside it.