0 votes

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?

in Engine by (18 points)

1 Answer

+1 vote

https://godotengine.org/qa/9249/mask-a-sprite-with-a-dynamic-mask
is this what you are looking for?
here is the demo project, I'm not sure if it would work with polygons though https://godotengine.org/asset-library/asset/115

by (82 points)

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.

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.

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.
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 webmaster@godotengine.org with your username.