class_collisionpolygon2d.rst 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/CollisionPolygon2D.xml.
  6. .. _class_CollisionPolygon2D:
  7. CollisionPolygon2D
  8. ==================
  9. **Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. Defines a 2D collision polygon.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Provides a 2D collision polygon to a :ref:`CollisionObject2D<class_CollisionObject2D>` parent. Polygons can be drawn in the editor or specified by a list of vertices.
  15. .. rst-class:: classref-reftable-group
  16. Properties
  17. ----------
  18. .. table::
  19. :widths: auto
  20. +-----------------------------------------------------+---------------------------------------------------------------------------------------------+--------------------------+
  21. | :ref:`BuildMode<enum_CollisionPolygon2D_BuildMode>` | :ref:`build_mode<class_CollisionPolygon2D_property_build_mode>` | ``0`` |
  22. +-----------------------------------------------------+---------------------------------------------------------------------------------------------+--------------------------+
  23. | :ref:`bool<class_bool>` | :ref:`disabled<class_CollisionPolygon2D_property_disabled>` | ``false`` |
  24. +-----------------------------------------------------+---------------------------------------------------------------------------------------------+--------------------------+
  25. | :ref:`bool<class_bool>` | :ref:`one_way_collision<class_CollisionPolygon2D_property_one_way_collision>` | ``false`` |
  26. +-----------------------------------------------------+---------------------------------------------------------------------------------------------+--------------------------+
  27. | :ref:`float<class_float>` | :ref:`one_way_collision_margin<class_CollisionPolygon2D_property_one_way_collision_margin>` | ``1.0`` |
  28. +-----------------------------------------------------+---------------------------------------------------------------------------------------------+--------------------------+
  29. | :ref:`PoolVector2Array<class_PoolVector2Array>` | :ref:`polygon<class_CollisionPolygon2D_property_polygon>` | ``PoolVector2Array( )`` |
  30. +-----------------------------------------------------+---------------------------------------------------------------------------------------------+--------------------------+
  31. .. rst-class:: classref-section-separator
  32. ----
  33. .. rst-class:: classref-descriptions-group
  34. Enumerations
  35. ------------
  36. .. _enum_CollisionPolygon2D_BuildMode:
  37. .. rst-class:: classref-enumeration
  38. enum **BuildMode**:
  39. .. _class_CollisionPolygon2D_constant_BUILD_SOLIDS:
  40. .. rst-class:: classref-enumeration-constant
  41. :ref:`BuildMode<enum_CollisionPolygon2D_BuildMode>` **BUILD_SOLIDS** = ``0``
  42. Collisions will include the polygon and its contained area.
  43. .. _class_CollisionPolygon2D_constant_BUILD_SEGMENTS:
  44. .. rst-class:: classref-enumeration-constant
  45. :ref:`BuildMode<enum_CollisionPolygon2D_BuildMode>` **BUILD_SEGMENTS** = ``1``
  46. Collisions will only include the polygon edges.
  47. .. rst-class:: classref-section-separator
  48. ----
  49. .. rst-class:: classref-descriptions-group
  50. Property Descriptions
  51. ---------------------
  52. .. _class_CollisionPolygon2D_property_build_mode:
  53. .. rst-class:: classref-property
  54. :ref:`BuildMode<enum_CollisionPolygon2D_BuildMode>` **build_mode** = ``0``
  55. .. rst-class:: classref-property-setget
  56. - void **set_build_mode** **(** :ref:`BuildMode<enum_CollisionPolygon2D_BuildMode>` value **)**
  57. - :ref:`BuildMode<enum_CollisionPolygon2D_BuildMode>` **get_build_mode** **(** **)**
  58. Collision build mode. Use one of the :ref:`BuildMode<enum_CollisionPolygon2D_BuildMode>` constants.
  59. .. rst-class:: classref-item-separator
  60. ----
  61. .. _class_CollisionPolygon2D_property_disabled:
  62. .. rst-class:: classref-property
  63. :ref:`bool<class_bool>` **disabled** = ``false``
  64. .. rst-class:: classref-property-setget
  65. - void **set_disabled** **(** :ref:`bool<class_bool>` value **)**
  66. - :ref:`bool<class_bool>` **is_disabled** **(** **)**
  67. If ``true``, no collisions will be detected.
  68. .. rst-class:: classref-item-separator
  69. ----
  70. .. _class_CollisionPolygon2D_property_one_way_collision:
  71. .. rst-class:: classref-property
  72. :ref:`bool<class_bool>` **one_way_collision** = ``false``
  73. .. rst-class:: classref-property-setget
  74. - void **set_one_way_collision** **(** :ref:`bool<class_bool>` value **)**
  75. - :ref:`bool<class_bool>` **is_one_way_collision_enabled** **(** **)**
  76. If ``true``, only edges that face up, relative to **CollisionPolygon2D**'s rotation, will collide with other objects.
  77. \ **Note:** This property has no effect if this **CollisionPolygon2D** is a child of an :ref:`Area2D<class_Area2D>` node.
  78. .. rst-class:: classref-item-separator
  79. ----
  80. .. _class_CollisionPolygon2D_property_one_way_collision_margin:
  81. .. rst-class:: classref-property
  82. :ref:`float<class_float>` **one_way_collision_margin** = ``1.0``
  83. .. rst-class:: classref-property-setget
  84. - void **set_one_way_collision_margin** **(** :ref:`float<class_float>` value **)**
  85. - :ref:`float<class_float>` **get_one_way_collision_margin** **(** **)**
  86. The margin used for one-way collision (in pixels). Higher values will make the shape thicker, and work better for colliders that enter the polygon at a high velocity.
  87. .. rst-class:: classref-item-separator
  88. ----
  89. .. _class_CollisionPolygon2D_property_polygon:
  90. .. rst-class:: classref-property
  91. :ref:`PoolVector2Array<class_PoolVector2Array>` **polygon** = ``PoolVector2Array( )``
  92. .. rst-class:: classref-property-setget
  93. - void **set_polygon** **(** :ref:`PoolVector2Array<class_PoolVector2Array>` value **)**
  94. - :ref:`PoolVector2Array<class_PoolVector2Array>` **get_polygon** **(** **)**
  95. The polygon's list of vertices. The final point will be connected to the first. The returned value is a clone of the :ref:`PoolVector2Array<class_PoolVector2Array>`, not a reference.
  96. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  97. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  98. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  99. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`