.. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead. .. _class_Polygon2D: Polygon2D ========= **Inherits:** :ref:`Node2D` **<** :ref:`CanvasItem` **<** :ref:`Node` **<** :ref:`Object` **Category:** Core Brief Description ----------------- 2D polygon representation Member Functions ---------------- +------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_polygon` **(** :ref:`Vector2Array` polygon **)** | +------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2Array` | :ref:`get_polygon` **(** **)** const | +------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_uv` **(** :ref:`Vector2Array` uv **)** | +------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2Array` | :ref:`get_uv` **(** **)** const | +------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_color` **(** :ref:`Color` color **)** | +------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+ | :ref:`Color` | :ref:`get_color` **(** **)** const | +------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_texture` **(** :ref:`Object` texture **)** | +------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+ | :ref:`Object` | :ref:`get_texture` **(** **)** const | +------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_texture_offset` **(** :ref:`Vector2` texture_offset **)** | +------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`get_texture_offset` **(** **)** const | +------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_texture_rotation` **(** :ref:`float` texture_rotation **)** | +------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_texture_rotation` **(** **)** const | +------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_texture_scale` **(** :ref:`Vector2` texture_scale **)** | +------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`get_texture_scale` **(** **)** const | +------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_invert` **(** :ref:`bool` invert **)** | +------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`get_invert` **(** **)** const | +------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_invert_border` **(** :ref:`float` invert_border **)** | +------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_invert_border` **(** **)** const | +------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_offset` **(** :ref:`Vector2` offset **)** | +------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`get_offset` **(** **)** const | +------------------------------------------+----------------------------------------------------------------------------------------------------------------------------+ Description ----------- A Polygon2D is defined by a set of n points connected together by line segments, meaning that the point 1 will be connected with point 2, point 2 with point 3 ..., point n-1 with point n and point n with point 1 in order to close the loop and define a plane. Member Function Description --------------------------- .. _class_Polygon2D_set_polygon: - void **set_polygon** **(** :ref:`Vector2Array` polygon **)** Defines the set of points that will represent the polygon. .. _class_Polygon2D_get_polygon: - :ref:`Vector2Array` **get_polygon** **(** **)** const Returns the set of points that defines this polygon .. _class_Polygon2D_set_uv: - void **set_uv** **(** :ref:`Vector2Array` uv **)** Sets the uv value for every point of the polygon .. _class_Polygon2D_get_uv: - :ref:`Vector2Array` **get_uv** **(** **)** const Returns the uv value associated with every point of the polygon .. _class_Polygon2D_set_color: - void **set_color** **(** :ref:`Color` color **)** Sets the polygon fill color, if the polygon has a texture defined, the defined texture will be tinted to the polygon fill color. .. _class_Polygon2D_get_color: - :ref:`Color` **get_color** **(** **)** const Returns the polygon fill color .. _class_Polygon2D_set_texture: - void **set_texture** **(** :ref:`Object` texture **)** Sets the polygon texture. .. _class_Polygon2D_get_texture: - :ref:`Object` **get_texture** **(** **)** const Returns the polygon texture .. _class_Polygon2D_set_texture_offset: - void **set_texture_offset** **(** :ref:`Vector2` texture_offset **)** Sets the offset of the polygon texture. Initially the texture will appear anchored to the polygon position, the offset is used to move the texture location away from that point (notice that the texture origin is set to its top left corner, so when offset is 0,0 the top left corner of the texture is at the polygon position), for example setting the offset to 10, 10 will move the texture 10 units to the left and 10 units to the top. .. _class_Polygon2D_get_texture_offset: - :ref:`Vector2` **get_texture_offset** **(** **)** const Returns the polygon texture offset .. _class_Polygon2D_set_texture_rotation: - void **set_texture_rotation** **(** :ref:`float` texture_rotation **)** Sets the amount of rotation of the polygon texture, ``texture_rotation`` is specified in degrees and clockwise rotation, meaning that if the texture rotation is set to 45 degrees, the texture will be rotated 45 degrees clockwise along the polygon position plus the texture offset. .. _class_Polygon2D_get_texture_rotation: - :ref:`float` **get_texture_rotation** **(** **)** const Returns the rotation in degrees of the texture polygon .. _class_Polygon2D_set_texture_scale: - void **set_texture_scale** **(** :ref:`Vector2` texture_scale **)** .. _class_Polygon2D_get_texture_scale: - :ref:`Vector2` **get_texture_scale** **(** **)** const .. _class_Polygon2D_set_invert: - void **set_invert** **(** :ref:`bool` invert **)** Sets the polygon as the defined polygon bounding box minus the defined polygon (the defined polygon will appear as a hole on square that contains the defined polygon). .. _class_Polygon2D_get_invert: - :ref:`bool` **get_invert** **(** **)** const Returns whether this polygon is inverted or not .. _class_Polygon2D_set_invert_border: - void **set_invert_border** **(** :ref:`float` invert_border **)** .. _class_Polygon2D_get_invert_border: - :ref:`float` **get_invert_border** **(** **)** const .. _class_Polygon2D_set_offset: - void **set_offset** **(** :ref:`Vector2` offset **)** Sets the amount of distance from the polygon points from the polygon position, for example if the offset is set to 10,10 then all the polygon points will move 10 units to the right and 10 units to the bottom. .. _class_Polygon2D_get_offset: - :ref:`Vector2` **get_offset** **(** **)** const Returns the polygon points offset to the polygon position.