class_collisionpolygon2d.rst 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the CollisionPolygon2D.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_CollisionPolygon2D:
  6. CollisionPolygon2D
  7. ==================
  8. **Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Defines a 2D collision polygon.
  13. Properties
  14. ----------
  15. +-----------------------------------------------------+---------------------------------------------------------------------------------------------+
  16. | :ref:`BuildMode<enum_CollisionPolygon2D_BuildMode>` | :ref:`build_mode<class_CollisionPolygon2D_property_build_mode>` |
  17. +-----------------------------------------------------+---------------------------------------------------------------------------------------------+
  18. | :ref:`bool<class_bool>` | :ref:`disabled<class_CollisionPolygon2D_property_disabled>` |
  19. +-----------------------------------------------------+---------------------------------------------------------------------------------------------+
  20. | :ref:`bool<class_bool>` | :ref:`one_way_collision<class_CollisionPolygon2D_property_one_way_collision>` |
  21. +-----------------------------------------------------+---------------------------------------------------------------------------------------------+
  22. | :ref:`float<class_float>` | :ref:`one_way_collision_margin<class_CollisionPolygon2D_property_one_way_collision_margin>` |
  23. +-----------------------------------------------------+---------------------------------------------------------------------------------------------+
  24. | :ref:`PoolVector2Array<class_PoolVector2Array>` | :ref:`polygon<class_CollisionPolygon2D_property_polygon>` |
  25. +-----------------------------------------------------+---------------------------------------------------------------------------------------------+
  26. Enumerations
  27. ------------
  28. .. _enum_CollisionPolygon2D_BuildMode:
  29. .. _class_CollisionPolygon2D_constant_BUILD_SOLIDS:
  30. .. _class_CollisionPolygon2D_constant_BUILD_SEGMENTS:
  31. enum **BuildMode**:
  32. - **BUILD_SOLIDS** = **0** --- Collisions will include the polygon and its contained area.
  33. - **BUILD_SEGMENTS** = **1** --- Collisions will only include the polygon edges.
  34. Description
  35. -----------
  36. 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.
  37. Property Descriptions
  38. ---------------------
  39. .. _class_CollisionPolygon2D_property_build_mode:
  40. - :ref:`BuildMode<enum_CollisionPolygon2D_BuildMode>` **build_mode**
  41. +----------+-----------------------+
  42. | *Setter* | set_build_mode(value) |
  43. +----------+-----------------------+
  44. | *Getter* | get_build_mode() |
  45. +----------+-----------------------+
  46. Collision build mode. Use one of the ``BUILD_*`` constants. Default value: :ref:`BUILD_SOLIDS<class_CollisionPolygon2D_constant_BUILD_SOLIDS>`.
  47. ----
  48. .. _class_CollisionPolygon2D_property_disabled:
  49. - :ref:`bool<class_bool>` **disabled**
  50. +----------+---------------------+
  51. | *Setter* | set_disabled(value) |
  52. +----------+---------------------+
  53. | *Getter* | is_disabled() |
  54. +----------+---------------------+
  55. If ``true``, no collisions will be detected.
  56. ----
  57. .. _class_CollisionPolygon2D_property_one_way_collision:
  58. - :ref:`bool<class_bool>` **one_way_collision**
  59. +----------+--------------------------------+
  60. | *Setter* | set_one_way_collision(value) |
  61. +----------+--------------------------------+
  62. | *Getter* | is_one_way_collision_enabled() |
  63. +----------+--------------------------------+
  64. If ``true``, only edges that face up, relative to CollisionPolygon2D's rotation, will collide with other objects.
  65. ----
  66. .. _class_CollisionPolygon2D_property_one_way_collision_margin:
  67. - :ref:`float<class_float>` **one_way_collision_margin**
  68. +----------+-------------------------------------+
  69. | *Setter* | set_one_way_collision_margin(value) |
  70. +----------+-------------------------------------+
  71. | *Getter* | get_one_way_collision_margin() |
  72. +----------+-------------------------------------+
  73. ----
  74. .. _class_CollisionPolygon2D_property_polygon:
  75. - :ref:`PoolVector2Array<class_PoolVector2Array>` **polygon**
  76. +----------+--------------------+
  77. | *Setter* | set_polygon(value) |
  78. +----------+--------------------+
  79. | *Getter* | get_polygon() |
  80. +----------+--------------------+
  81. 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.