Hide part of the sprite

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By max3312

I have a transparent object, behind which the tail is drawn. It is necessary to make sure that it is not drawn under the object. Is it possible to erase part of the sprite? Using Polygon2D. Is it possible to make so that apart from the background, behind a transparent object, nothing is drawn?

:bust_in_silhouette: Reply From: KnightNine

is this what you are looking for?
here is the demo project, I’m not sure if it would work with polygons though 2D Light Masks Demo - Godot Asset Library

I found a suitable solution, but the shape is always a rectangle and I don’t know how to get a polygon. I used Light2D in mask mode. Then I set the transparency of light to zero. But in addition to erasing behind the object, the entire Light2D area was also erased.
No, this solution does not suit me. I need to erase everything in the light, not show it. I did not find a way to do the opposite.

max3312 | 2019-09-11 08:56

I have found a way. You need to add two backgrounds, one will be behind, the other under the object, but above everything else. And using the effect from your example, you can achieve a cross-copy with the near background of all other objects.

max3312 | 2019-09-11 11:25