I am hoping to use Node2D.drawpolygon() to draw in a nice overlay for a section of my screen. I am calculating an outline for an area, and feeding that set of points ([Vector2]) to the drawpolygon method. I have verified that the method gets the data correctly and that it looks like a complete shape, but I am getting a "Bad Polygon!" error from the engine.
Here is my code:
var _outline_polygon = Vector2Array()
var _colors = ColorArray([Color(0,1,0,.5)])
var _drawing = false
#generate the polygon that represents this room
_outline_polygon = poly_path
print(get_name(), ": ", _outline_polygon)
# _drawing = true
Here is an example of the content of the outlinepolygon variable:
room_8: [(256, 448), (320, 448), (320, 448), (384, 448), (384, 448),
(384, 512), (384, 512), (384, 576), (384, 576), (320, 576), (320,
576), (256, 576), (256, 576), (256, 512), (256, 512), (256, 448)]
Here is the error I am getting - sorry about the image link, it is a screen shot. But basically says "Bad Polygon!" and seems to be coming from something called: visualserverraster.cpp in the back end.
Any ideas? What should I be passing into the function to get a nice polygon out on the other side?