A 2D polygon.
    public class Polygon2D : Node2D

A Polygon2D is defined by a set of points. Each point is connected to the next, with the final point being connected to the first, resulting in a closed polygon. Polygon2Ds can be filled with color (solid or gradient) or filled with a given texture.

Inheritance Chain

Constructors

    public Polygon2D()

Properties

    public bool Antialiased { get; set; }

If true, polygon edges will be anti-aliased. Default value: false.

    public Collections.Array Bones { get; set; }

    public Color Color { get; set; }

The polygon’s fill color. If texture is defined, it will be multiplied by this color. It will also be the default color for vertices not set in vertex_colors.

    public int InternalVertexCount { get; set; }

    public float InvertBorder { get; set; }

Added padding applied to the bounding box when using invert. Setting this value too small may result in a “Bad Polygon” error. Default value: 100.

    public bool InvertEnable { get; set; }

If true, polygon will be inverted, containing the area outside the defined points and extending to the invert_border. Default value: false.

    public Vector2 Offset { get; set; }

The offset applied to each vertex.

    public Vector2[] Polygon { get; set; }

The polygon’s list of vertices. The final point will be connected to the first. Note that this returns a copy of the PoolVector2Array rather than a reference.

    public Collections.Array Polygons { get; set; }

    public NodePath Skeleton { get; set; }

    public Texture Texture { get; set; }

The polygon’s fill texture. Use uv to set texture coordinates.

    public Vector2 TextureOffset { get; set; }

Amount to offset the polygon’s texture. If (0, 0) the texture’s origin (its top-left corner) will be placed at the polygon’s position.

    public float TextureRotation { get; set; }

The texture’s rotation in radians.

    public float TextureRotationDegrees { get; set; }

The texture’s rotation in degrees.

    public Vector2 TextureScale { get; set; }

Amount to multiply the uv coordinates when using a texture. Larger values make the texture smaller, and vice versa.

    public Vector2[] Uv { get; set; }

Texture coordinates for each vertex of the polygon. There should be one uv per polygon vertex. If there are fewer, undefined vertices will use (0, 0).

    public Color[] VertexColors { get; set; }

Color for each vertex. Colors are interpolated between vertices, resulting in smooth gradients. There should be one per polygon vertex. If there are fewer, undefined vertices will use color.

Methods

    public void AddBone(NodePath path, float[] weights)

    public void ClearBones()

    public void EraseBone(int index)

    public bool GetAntialiased()

Getter for Antialiased

    public int GetBoneCount()

    public NodePath GetBonePath(int index)

    public float[] GetBoneWeights(int index)

    public Color GetColor()

Getter for Color

    public int GetInternalVertexCount()

Getter for InternalVertexCount

    public bool GetInvert()

Getter for InvertEnable

    public float GetInvertBorder()

Getter for InvertBorder

    public Vector2 GetOffset()

Getter for Offset

    public Vector2[] GetPolygon()

Getter for Polygon

    public Godot.Collections.Array GetPolygons()

Getter for Polygons

    public NodePath GetSkeleton()

Getter for Skeleton

    public Texture GetTexture()

Getter for Texture

    public Vector2 GetTextureOffset()

Getter for TextureOffset

    public float GetTextureRotation()

    public float GetTextureRotationDegrees()

Getter for TextureRotation

    public Vector2 GetTextureScale()

Getter for TextureScale

    public Vector2[] GetUv()

Getter for Uv

    public Color[] GetVertexColors()

Getter for VertexColors

    public void SetAntialiased(bool antialiased)

Setter for Antialiased

    public void SetBonePath(int index, NodePath path)

    public void SetBoneWeights(int index, float[] weights)

    public void SetColor(Color color)

Setter for Color

    public void SetInternalVertexCount(int internalVertexCount)

Setter for InternalVertexCount

    public void SetInvert(bool invert)

Setter for InvertEnable

    public void SetInvertBorder(float invertBorder)

Setter for InvertBorder

    public void SetOffset(Vector2 offset)

Setter for Offset

    public void SetPolygon(Vector2[] polygon)

Setter for Polygon

    public void SetPolygons(Godot.Collections.Array polygons)

Setter for Polygons

    public void SetSkeleton(NodePath skeleton)

Setter for Skeleton

    public void SetTexture(Texture texture)

Setter for Texture

    public void SetTextureOffset(Vector2 textureOffset)

Setter for TextureOffset

    public void SetTextureRotation(float textureRotation)

    public void SetTextureRotationDegrees(float textureRotation)

Setter for TextureRotation

    public void SetTextureScale(Vector2 textureScale)

Setter for TextureScale

    public void SetUv(Vector2[] uv)

Setter for Uv

    public void SetVertexColors(Color[] vertexColors)

Setter for VertexColors

Tags: