so the numSides is the number of sides/faces and the perimeter length is the length of the perimeter.

```
func generatePolygonV2(numSides, perimeterLength):
var lineLength : float = perimeterLength/numSides
var lineAngle : float = -360.0000000000/numSides
var currentAngle : float = 0.0000000000
var newPolygon = Polygon2D.new()
var polygonVectors : PoolVector2Array
for i in numSides:
var newVector
if i == 0:
currentAngle += lineAngle
newVector = Vector2(lineLength * cos(deg2rad(currentAngle)),lineLength * sin(deg2rad(currentAngle)))
polygonVectors.append(newVector)
else:
currentAngle += lineAngle
newVector = Vector2(polygonVectors[i-1].x + lineLength * cos(deg2rad(currentAngle)),polygonVectors[i-1].y + lineLength * sin(deg2rad(currentAngle)))
polygonVectors.append(newVector)
newPolygon.polygon = polygonVectors
newPolygon.color = Color(1,0,1)
node2d.add_child(newPolygon)
polygon = newPolygon
```

something like this? The only problem with my method is the polygon generated is not centered. I have an idea on how i could fix that but yeah i'm lazy.