How to cut off the part of CollisionPolygon hidden by one or few obstacles?

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

I’m using the CollisionPolygon2D as sensory area for my bots. I want to change the shape of this polygon depending on objects that collide with it and hide by themselves the objects behind them.

Is it possible to do in Godot without big CPU overhead?