.. 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_CollisionPolygon2D: CollisionPolygon2D ================== **Inherits:** :ref:`Node2D` **<** :ref:`CanvasItem` **<** :ref:`Node` **<** :ref:`Object` **Category:** Core Brief Description ----------------- Editor-only class for easy editing of collision polygons. Member Functions ---------------- +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_build_mode` **(** **)** const | +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PoolVector2Array` | :ref:`get_polygon` **(** **)** const | +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_disabled` **(** **)** const | +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_one_way_collision_enabled` **(** **)** const | +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_build_mode` **(** :ref:`int` build_mode **)** | +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_disabled` **(** :ref:`bool` disabled **)** | +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_one_way_collision` **(** :ref:`bool` enabled **)** | +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_polygon` **(** :ref:`PoolVector2Array` polygon **)** | +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------+ Member Variables ---------------- - :ref:`int` **build_mode** - :ref:`bool` **disabled** - :ref:`bool` **one_way_collision** - :ref:`PoolVector2Array` **polygon** Description ----------- Editor-only class. This is not present when running the game. It's used in the editor to properly edit and position collision shapes in :ref:`CollisionObject2D`. This is not accessible from regular code. This class is for editing custom shape polygons. Member Function Description --------------------------- .. _class_CollisionPolygon2D_get_build_mode: - :ref:`int` **get_build_mode** **(** **)** const Return whether the polygon is a :ref:`ConvexPolygonShape2D` (``build_mode==0``), or a :ref:`ConcavePolygonShape2D` (``build_mode==1``). .. _class_CollisionPolygon2D_get_polygon: - :ref:`PoolVector2Array` **get_polygon** **(** **)** const Return the list of points that define the polygon. .. _class_CollisionPolygon2D_is_disabled: - :ref:`bool` **is_disabled** **(** **)** const .. _class_CollisionPolygon2D_is_one_way_collision_enabled: - :ref:`bool` **is_one_way_collision_enabled** **(** **)** const .. _class_CollisionPolygon2D_set_build_mode: - void **set_build_mode** **(** :ref:`int` build_mode **)** Set whether the polygon is to be a :ref:`ConvexPolygonShape2D` (``build_mode==0``), or a :ref:`ConcavePolygonShape2D` (``build_mode==1``). .. _class_CollisionPolygon2D_set_disabled: - void **set_disabled** **(** :ref:`bool` disabled **)** .. _class_CollisionPolygon2D_set_one_way_collision: - void **set_one_way_collision** **(** :ref:`bool` enabled **)** .. _class_CollisionPolygon2D_set_polygon: - void **set_polygon** **(** :ref:`PoolVector2Array` polygon **)** Set the array of points forming the polygon. When editing the point list via the editor, depending on :ref:`get_build_mode`, it has to be a list of points (for ``build_mode==0``), or a list of lines (for ``build_mode==1``). In the second case, the even elements of the array define the start point of the line, and the odd elements the end point.