class_convexpolygonshape3d.rst 4.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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/4.0/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.0/doc/classes/ConvexPolygonShape3D.xml.
  6. .. _class_ConvexPolygonShape3D:
  7. ConvexPolygonShape3D
  8. ====================
  9. **Inherits:** :ref:`Shape3D<class_Shape3D>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Convex polygon shape resource for 3D physics.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. 3D convex polygon shape resource to be added as a *direct* child of a :ref:`PhysicsBody3D<class_PhysicsBody3D>` or :ref:`Area3D<class_Area3D>` using a :ref:`CollisionShape3D<class_CollisionShape3D>` node.
  15. The shape is a *solid* that includes all the points that it encloses, as opposed to :ref:`ConcavePolygonShape3D<class_ConcavePolygonShape3D>` which is hollow if it encloses anything. See also :ref:`CollisionPolygon3D<class_CollisionPolygon3D>`.
  16. The solid nature of the shape makes it well-suited for both detection and physics; in physics body interactions this allows depenetrating even those shapes which end up (e.g. due to high speed) fully inside the convex shape (similarly to primitive shapes, but unlike :ref:`ConcavePolygonShape3D<class_ConcavePolygonShape3D>` and :ref:`HeightMapShape3D<class_HeightMapShape3D>`). The convexity restricts the possible geometric shape of a single **ConvexPolygonShape3D**: it cannot be concave.
  17. \ **Convex decomposition:** Concave objects' collisions can be represented accurately using *several* convex shapes. This allows dynamic physics bodies to have complex concave collisions (at a performance cost). It can be achieved by using several **ConvexPolygonShape3D** nodes or by using the :ref:`CollisionPolygon3D<class_CollisionPolygon3D>` node. To generate a collision polygon from a mesh, select the :ref:`MeshInstance3D<class_MeshInstance3D>` node, go to the **Mesh** menu that appears above the viewport and choose **Create Multiple Convex Collision Siblings**. Alternatively, :ref:`MeshInstance3D.create_multiple_convex_collisions<class_MeshInstance3D_method_create_multiple_convex_collisions>` can be called in a script to perform this decomposition at run-time.
  18. \ **Performance:** **ConvexPolygonShape3D** is faster to check collisions against compared to :ref:`ConcavePolygonShape3D<class_ConcavePolygonShape3D>`, but it is slower than primitive collision shapes such as :ref:`SphereShape3D<class_SphereShape3D>` or :ref:`BoxShape3D<class_BoxShape3D>`. Its use should generally be limited to medium-sized objects that cannot have their collision accurately represented by primitive shapes.
  19. .. rst-class:: classref-introduction-group
  20. Tutorials
  21. ---------
  22. - `3D Physics Tests Demo <https://godotengine.org/asset-library/asset/675>`__
  23. .. rst-class:: classref-reftable-group
  24. Properties
  25. ----------
  26. .. table::
  27. :widths: auto
  28. +-----------------------------------------------------+-----------------------------------------------------------+--------------------------+
  29. | :ref:`PackedVector3Array<class_PackedVector3Array>` | :ref:`points<class_ConvexPolygonShape3D_property_points>` | ``PackedVector3Array()`` |
  30. +-----------------------------------------------------+-----------------------------------------------------------+--------------------------+
  31. .. rst-class:: classref-section-separator
  32. ----
  33. .. rst-class:: classref-descriptions-group
  34. Property Descriptions
  35. ---------------------
  36. .. _class_ConvexPolygonShape3D_property_points:
  37. .. rst-class:: classref-property
  38. :ref:`PackedVector3Array<class_PackedVector3Array>` **points** = ``PackedVector3Array()``
  39. .. rst-class:: classref-property-setget
  40. - void **set_points** **(** :ref:`PackedVector3Array<class_PackedVector3Array>` value **)**
  41. - :ref:`PackedVector3Array<class_PackedVector3Array>` **get_points** **(** **)**
  42. The list of 3D points forming the convex polygon shape.
  43. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  44. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  45. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  46. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  47. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  48. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`