Im making aoe skill visualization system and im using custom functions to create the polygons. I cant use _draw(). So Im creating polygons from points and adding them as a child. But I cant rotate a polygon2d. So I decided to add polygons to node2d as a child and rotate the node. But I cant synhronise node rotation with center point of my polygon. Can someone suggest me rotation method or better way to do it (I know about sprites, but i think its more flexible method than endless sprite redrawing)?

Polygon generation function:

``````func generate_arc_poly(angle, radius, start_position, finish_position, color: Color):
var arc_points = 30
var polygon = Polygon2D.new()
var points: PoolVector2Array
var direction = start_position.direction_to(finish_position) #get normilised direction
var central_point = direction * radius #get central Vector with radius lenght
var angle_delta: float = deg2rad(angle) / arc_points #calculating 1 step rotation angle
var compensate_angle: float = deg2rad(-angle) / 2
var vector: Vector2 = central_point

vector = vector.rotated(compensate_angle) #rotating to compensate starting point
points.append(start_position)

for point in arc_points:
points.append(vector + start_position)
vector = vector.rotated(angle_delta)
polygon.set_polygon(points)
polygon.color = color

return polygon
``````

Polygon creation and adding to the scene:

``````func aoe_vis_setup(leader, effects, parameters):
var polygon = effects.call_funcv(parameters)
var skill_visualise = Node2D.new()
visualization.append(skill_visualise)
``````

Parameters wich i pass to the function: `[90, 50, Vector2(0,8), Color(0,0,100,0.05)]`

And look_at function wich rotates Node2D:

``````for polygon in visualization: