offset_polygon method of Geometry2D class returns an array [(0,0)]

Good evening everyone, I’m trying to use the offset_polygon method on this polygon, but the result keeps returning as an array with [(0, 0)]. I saw someone mention in a similar issue:

“You are hitting the same ‘issue’ listed here: Geometry2D.clip_polygons() / Geometry2D.merge_polygons() returns [(0,0)] · Issue #87153 · godotengine/godot · GitHub, where casting an Array[PackedVector2Array] to a PackedVector2Array will make it [(0, 0)]”

But I couldn’t figure out how to apply that solution — or maybe it’s not actually the problem?

var _uniao = Polygon2D.new()
_uniao.name = “Uniao”
_uniao.polygon = resultado_union[0]
print(_uniao.polygon)
_uniao.polygon = Geometry2D.offset_polygon(_uniao.polygon, 20.0, 1)
_uniao.color = Color.AQUAMARINE
print(_uniao.polygon)

add_child(_uniao)

#prints [(395.1057, 269.0983), (358.7785, 380.9017), (141.2215, 380.9017), (104.8943, 269.0983), (200.0, 200.0), (250.0, 236.3271), (204.8943, 269.0983), (300.0, 200.0)]
#prints [(0.0, 0.0)]

The return value from Geometry2D.offset_polygon() is of type Array[PackedVector2Array]

And you are trying to cast that Array[PackedVector2Array] into the property of type PackedVector2Array. Instead, you should take the first value of the array and put that into your property. You already did that 2 lines above with the [0] at the end of the resultado_union[0], you should do the same here:

	_uniao.polygon = Geometry2D.offset_polygon(_uniao.polygon, 20.0, 1)[0]

I Get it. Tank you so much man! Days trying to undestand.