mirror of
https://github.com/godotengine/godot-docs.git
synced 2025-12-31 17:49:03 +03:00
117 lines
6.5 KiB
ReStructuredText
117 lines
6.5 KiB
ReStructuredText
.. Generated automatically by doc/tools/makerst.py in Godot's source tree.
|
|
.. DO NOT EDIT THIS FILE, but the CollisionPolygon2D.xml source instead.
|
|
.. The source is found in doc/classes or modules/<name>/doc_classes.
|
|
|
|
.. _class_CollisionPolygon2D:
|
|
|
|
CollisionPolygon2D
|
|
==================
|
|
|
|
**Inherits:** :ref:`Node2D<class_node2d>` **<** :ref:`CanvasItem<class_canvasitem>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
|
|
|
|
**Category:** Core
|
|
|
|
Brief Description
|
|
-----------------
|
|
|
|
Defines a 2D collision polygon.
|
|
|
|
Member Functions
|
|
----------------
|
|
|
|
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_build_mode<class_CollisionPolygon2D_get_build_mode>` **(** **)** const |
|
|
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PoolVector2Array<class_poolvector2array>` | :ref:`get_polygon<class_CollisionPolygon2D_get_polygon>` **(** **)** const |
|
|
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_disabled<class_CollisionPolygon2D_is_disabled>` **(** **)** const |
|
|
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_one_way_collision_enabled<class_CollisionPolygon2D_is_one_way_collision_enabled>` **(** **)** const |
|
|
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_build_mode<class_CollisionPolygon2D_set_build_mode>` **(** :ref:`int<class_int>` build_mode **)** |
|
|
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_disabled<class_CollisionPolygon2D_set_disabled>` **(** :ref:`bool<class_bool>` disabled **)** |
|
|
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_one_way_collision<class_CollisionPolygon2D_set_one_way_collision>` **(** :ref:`bool<class_bool>` enabled **)** |
|
|
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_polygon<class_CollisionPolygon2D_set_polygon>` **(** :ref:`PoolVector2Array<class_poolvector2array>` polygon **)** |
|
|
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
Member Variables
|
|
----------------
|
|
|
|
.. _class_CollisionPolygon2D_build_mode:
|
|
|
|
- :ref:`int<class_int>` **build_mode** - Collision build mode. Use one of the ``BUILD\_\*`` constants. Default value: ``BUILD_SOLIDS``.
|
|
|
|
.. _class_CollisionPolygon2D_disabled:
|
|
|
|
- :ref:`bool<class_bool>` **disabled** - If ``true`` no collisions will be detected.
|
|
|
|
.. _class_CollisionPolygon2D_one_way_collision:
|
|
|
|
- :ref:`bool<class_bool>` **one_way_collision** - If ``true`` only edges that face up, relative to CollisionPolygon2D's rotation, will collide with other objects.
|
|
|
|
.. _class_CollisionPolygon2D_polygon:
|
|
|
|
- :ref:`PoolVector2Array<class_poolvector2array>` **polygon** - The polygon's list of vertices. The final point will be connected to the first.
|
|
|
|
|
|
Numeric Constants
|
|
-----------------
|
|
|
|
- **BUILD_SOLIDS** = **0** --- Collisions will include the polygon and its contained area.
|
|
- **BUILD_SEGMENTS** = **1** --- Collisions will only include the polygon edges.
|
|
|
|
Description
|
|
-----------
|
|
|
|
Provides a 2D collision polygon to a :ref:`CollisionObject2D<class_collisionobject2d>` parent. Polygon can be drawn in the editor or specified by a list of vertices.
|
|
|
|
Member Function Description
|
|
---------------------------
|
|
|
|
.. _class_CollisionPolygon2D_get_build_mode:
|
|
|
|
- :ref:`int<class_int>` **get_build_mode** **(** **)** const
|
|
|
|
Return whether the polygon is a :ref:`ConvexPolygonShape2D<class_convexpolygonshape2d>` (``build_mode==0``), or a :ref:`ConcavePolygonShape2D<class_concavepolygonshape2d>` (``build_mode==1``).
|
|
|
|
.. _class_CollisionPolygon2D_get_polygon:
|
|
|
|
- :ref:`PoolVector2Array<class_poolvector2array>` **get_polygon** **(** **)** const
|
|
|
|
Return the list of points that define the polygon.
|
|
|
|
.. _class_CollisionPolygon2D_is_disabled:
|
|
|
|
- :ref:`bool<class_bool>` **is_disabled** **(** **)** const
|
|
|
|
.. _class_CollisionPolygon2D_is_one_way_collision_enabled:
|
|
|
|
- :ref:`bool<class_bool>` **is_one_way_collision_enabled** **(** **)** const
|
|
|
|
.. _class_CollisionPolygon2D_set_build_mode:
|
|
|
|
- void **set_build_mode** **(** :ref:`int<class_int>` build_mode **)**
|
|
|
|
Set whether the polygon is to be a :ref:`ConvexPolygonShape2D<class_convexpolygonshape2d>` (``build_mode==0``), or a :ref:`ConcavePolygonShape2D<class_concavepolygonshape2d>` (``build_mode==1``).
|
|
|
|
.. _class_CollisionPolygon2D_set_disabled:
|
|
|
|
- void **set_disabled** **(** :ref:`bool<class_bool>` disabled **)**
|
|
|
|
.. _class_CollisionPolygon2D_set_one_way_collision:
|
|
|
|
- void **set_one_way_collision** **(** :ref:`bool<class_bool>` enabled **)**
|
|
|
|
.. _class_CollisionPolygon2D_set_polygon:
|
|
|
|
- void **set_polygon** **(** :ref:`PoolVector2Array<class_poolvector2array>` polygon **)**
|
|
|
|
Set the array of points forming the polygon.
|
|
|
|
When editing the point list via the editor, depending on :ref:`get_build_mode<class_CollisionPolygon2D_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.
|
|
|
|
|