class_concavepolygonshape3d.rst 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/ConcavePolygonShape3D.xml.
  6. .. _class_ConcavePolygonShape3D:
  7. ConcavePolygonShape3D
  8. =====================
  9. **Inherits:** :ref:`Shape3D<class_Shape3D>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Concave polygon shape resource (also called "trimesh") for 3D physics.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. 3D concave polygon shape resource (also called "trimesh") 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. This shape is created by feeding a list of triangles. Despite its name, **ConcavePolygonShape3D** can also store convex polygon shapes. However, unlike :ref:`ConvexPolygonShape3D<class_ConvexPolygonShape3D>`, **ConcavePolygonShape3D** is *not* limited to storing convex shapes exclusively.
  15. \ **Note:** When used for collision, **ConcavePolygonShape3D** is intended to work with static :ref:`PhysicsBody3D<class_PhysicsBody3D>` nodes like :ref:`StaticBody3D<class_StaticBody3D>` and will not work with :ref:`CharacterBody3D<class_CharacterBody3D>` or :ref:`RigidBody3D<class_RigidBody3D>` with a mode other than Static.
  16. \ **Performance:** Due to its complexity, **ConcavePolygonShape3D** is the slowest collision shape to check collisions against. Its use should generally be limited to level geometry. For convex geometry, using :ref:`ConvexPolygonShape3D<class_ConvexPolygonShape3D>` will perform better. For dynamic physics bodies that need concave collision, several :ref:`ConvexPolygonShape3D<class_ConvexPolygonShape3D>`\ s can be used to represent its collision by using convex decomposition; see :ref:`ConvexPolygonShape3D<class_ConvexPolygonShape3D>`'s documentation for instructions. However, consider using primitive collision shapes such as :ref:`SphereShape3D<class_SphereShape3D>` or :ref:`BoxShape3D<class_BoxShape3D>` first.
  17. \ **Warning:** Using this shape for an :ref:`Area3D<class_Area3D>` (via a :ref:`CollisionShape3D<class_CollisionShape3D>` node, created e.g. by using the *Create Trimesh Collision Sibling* option in the *Mesh* menu that appears when selecting a :ref:`MeshInstance3D<class_MeshInstance3D>` node) may give unexpected results: the area will only detect collisions with the triangle faces in the **ConcavePolygonShape3D** (and not with any "inside" of the shape, for example); moreover it will only detect all such collisions if :ref:`backface_collision<class_ConcavePolygonShape3D_property_backface_collision>` is ``true``.
  18. .. rst-class:: classref-introduction-group
  19. Tutorials
  20. ---------
  21. - `3D Physics Tests Demo <https://godotengine.org/asset-library/asset/675>`__
  22. .. rst-class:: classref-reftable-group
  23. Properties
  24. ----------
  25. .. table::
  26. :widths: auto
  27. +-------------------------+------------------------------------------------------------------------------------+-----------+
  28. | :ref:`bool<class_bool>` | :ref:`backface_collision<class_ConcavePolygonShape3D_property_backface_collision>` | ``false`` |
  29. +-------------------------+------------------------------------------------------------------------------------+-----------+
  30. .. rst-class:: classref-reftable-group
  31. Methods
  32. -------
  33. .. table::
  34. :widths: auto
  35. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`PackedVector3Array<class_PackedVector3Array>` | :ref:`get_faces<class_ConcavePolygonShape3D_method_get_faces>` **(** **)** |const| |
  37. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  38. | void | :ref:`set_faces<class_ConcavePolygonShape3D_method_set_faces>` **(** :ref:`PackedVector3Array<class_PackedVector3Array>` faces **)** |
  39. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  40. .. rst-class:: classref-section-separator
  41. ----
  42. .. rst-class:: classref-descriptions-group
  43. Property Descriptions
  44. ---------------------
  45. .. _class_ConcavePolygonShape3D_property_backface_collision:
  46. .. rst-class:: classref-property
  47. :ref:`bool<class_bool>` **backface_collision** = ``false``
  48. .. rst-class:: classref-property-setget
  49. - void **set_backface_collision_enabled** **(** :ref:`bool<class_bool>` value **)**
  50. - :ref:`bool<class_bool>` **is_backface_collision_enabled** **(** **)**
  51. If set to ``true``, collisions occur on both sides of the concave shape faces. Otherwise they occur only along the face normals.
  52. .. rst-class:: classref-section-separator
  53. ----
  54. .. rst-class:: classref-descriptions-group
  55. Method Descriptions
  56. -------------------
  57. .. _class_ConcavePolygonShape3D_method_get_faces:
  58. .. rst-class:: classref-method
  59. :ref:`PackedVector3Array<class_PackedVector3Array>` **get_faces** **(** **)** |const|
  60. Returns the faces (an array of triangles).
  61. .. rst-class:: classref-item-separator
  62. ----
  63. .. _class_ConcavePolygonShape3D_method_set_faces:
  64. .. rst-class:: classref-method
  65. void **set_faces** **(** :ref:`PackedVector3Array<class_PackedVector3Array>` faces **)**
  66. Sets the faces (an array of triangles).
  67. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  68. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  69. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  70. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  71. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  72. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`