class_convexpolygonshape2d.rst 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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/ConvexPolygonShape2D.xml.
  6. .. _class_ConvexPolygonShape2D:
  7. ConvexPolygonShape2D
  8. ====================
  9. **Inherits:** :ref:`Shape2D<class_Shape2D>` **<** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  10. Convex polygon shape for 2D physics.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Convex polygon shape for 2D physics. A convex polygon, whatever its shape, is internally decomposed into as many convex polygons as needed to ensure all collision checks against it are always done on convex polygons (which are faster to check).
  15. The main difference between a **ConvexPolygonShape2D** and a :ref:`ConcavePolygonShape2D<class_ConcavePolygonShape2D>` is that a concave polygon assumes it is concave and uses a more complex method of collision detection, and a convex one forces itself to be convex in order to speed up collision detection.
  16. .. rst-class:: classref-reftable-group
  17. Properties
  18. ----------
  19. .. table::
  20. :widths: auto
  21. +-------------------------------------------------+-----------------------------------------------------------+--------------------------+
  22. | :ref:`PoolVector2Array<class_PoolVector2Array>` | :ref:`points<class_ConvexPolygonShape2D_property_points>` | ``PoolVector2Array( )`` |
  23. +-------------------------------------------------+-----------------------------------------------------------+--------------------------+
  24. .. rst-class:: classref-reftable-group
  25. Methods
  26. -------
  27. .. table::
  28. :widths: auto
  29. +------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | void | :ref:`set_point_cloud<class_ConvexPolygonShape2D_method_set_point_cloud>` **(** :ref:`PoolVector2Array<class_PoolVector2Array>` point_cloud **)** |
  31. +------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  32. .. rst-class:: classref-section-separator
  33. ----
  34. .. rst-class:: classref-descriptions-group
  35. Property Descriptions
  36. ---------------------
  37. .. _class_ConvexPolygonShape2D_property_points:
  38. .. rst-class:: classref-property
  39. :ref:`PoolVector2Array<class_PoolVector2Array>` **points** = ``PoolVector2Array( )``
  40. .. rst-class:: classref-property-setget
  41. - void **set_points** **(** :ref:`PoolVector2Array<class_PoolVector2Array>` value **)**
  42. - :ref:`PoolVector2Array<class_PoolVector2Array>` **get_points** **(** **)**
  43. The polygon's list of vertices. Can be in either clockwise or counterclockwise order. Only set this property with convex hull points, use :ref:`set_point_cloud<class_ConvexPolygonShape2D_method_set_point_cloud>` to generate a convex hull shape from concave shape points.
  44. .. rst-class:: classref-section-separator
  45. ----
  46. .. rst-class:: classref-descriptions-group
  47. Method Descriptions
  48. -------------------
  49. .. _class_ConvexPolygonShape2D_method_set_point_cloud:
  50. .. rst-class:: classref-method
  51. void **set_point_cloud** **(** :ref:`PoolVector2Array<class_PoolVector2Array>` point_cloud **)**
  52. Based on the set of points provided, this creates and assigns the :ref:`points<class_ConvexPolygonShape2D_property_points>` property using the convex hull algorithm. Removing all unneeded points. See :ref:`Geometry.convex_hull_2d<class_Geometry_method_convex_hull_2d>` for details.
  53. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  54. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  55. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  56. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`