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 float OneWayCollisionMargin { get; set; }

    public Vector2[] Polygon { get; set; }

The polygon’s list of vertices. The final point will be connected to the first. The returned value is a clone of the PoolVector2Array, not a reference.


    public BuildModeEnum GetBuildMode()

Getter for BuildMode

    public float GetOneWayCollisionMargin()

Getter for OneWayCollisionMargin

    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 SetOneWayCollisionMargin(float margin)

Setter for OneWayCollisionMargin

    public void SetPolygon(Vector2[] polygon)

Setter for Polygon

Inner Types


Name Value Description