Defines a 2D collision polygon.
    public class CollisionPolygon2D : Node2D

Provides a 2D collision polygon to a CollisionObject2D parent. Polygon can be drawn in the editor or specified by a list of vertices.

Inheritance Chain


    public CollisionPolygon2D()


    public BuildModeEnum BuildMode { get; set; }

Collision build mode. Use one of the BUILD_* constants. Default value: BUILD_SOLIDS.

    public bool Disabled { get; set; }

If true no collisions will be detected.

    public bool OneWayCollision { get; set; }

If true only edges that face up, relative to CollisionPolygon2D’s rotation, will collide with other objects.

    public Vector2[] Polygon { get; set; }

The polygon’s list of vertices. The final point will be connected to the first.


    public BuildModeEnum GetBuildMode()

Getter for BuildMode

    public Vector2[] GetPolygon()

Getter for Polygon

    public bool IsDisabled()

Getter for Disabled

    public bool IsOneWayCollisionEnabled()

Getter for OneWayCollision

    public void SetBuildMode(BuildModeEnum buildMode)

Setter for BuildMode

    public void SetDisabled(bool disabled)

Setter for Disabled

    public void SetOneWayCollision(bool enabled)

Setter for OneWayCollision

    public void SetPolygon(Vector2[] polygon)

Setter for Polygon

Inner Types


Name Value Description
olids 0 Collisions will include the polygon and its contained area.
egments 1 Collisions will only include the polygon edges.