How can i move a single point of a polygon2d in code?

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

I want to move points of a polygon2d in code, with GDscript. I really dont know where to start with this problem.

:bust_in_silhouette: Reply From: Inces

Polygon2d.polygon returns an array of all points for this shape. Identify points You need to move, and refer to them just as You would refer to an array entries :

Polygon2d.polygon[3] += Vector2(5,0)

this moves 4th point of polygon 5 pixels to the right

Thanks a lot, it is working… <3 :smiley:

DarksideRestore | 2022-09-05 22:02