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

Constructors

    public CollisionPolygon2D()

Properties

    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.

Methods

    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

BuildModeEnum

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