class_gltfphysicsshape.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  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.2/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.2/modules/gltf/doc_classes/GLTFPhysicsShape.xml.
  6. .. _class_GLTFPhysicsShape:
  7. GLTFPhysicsShape
  8. ================
  9. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Represents a GLTF physics shape.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Represents a physics shape as defined by the ``OMI_collider`` GLTF extension. This class is an intermediary between the GLTF data and Godot's nodes, and it's abstracted in a way that allows adding support for different GLTF physics extensions in the future.
  15. .. rst-class:: classref-introduction-group
  16. Tutorials
  17. ---------
  18. - :doc:`Runtime file loading and saving <../tutorials/io/runtime_file_loading_and_saving>`
  19. - `OMI_collider GLTF extension <https://github.com/omigroup/gltf-extensions/tree/main/extensions/2.0/OMI_collider>`__
  20. .. rst-class:: classref-reftable-group
  21. Properties
  22. ----------
  23. .. table::
  24. :widths: auto
  25. +-----------------------------------------+---------------------------------------------------------------------+----------------------+
  26. | :ref:`float<class_float>` | :ref:`height<class_GLTFPhysicsShape_property_height>` | ``2.0`` |
  27. +-----------------------------------------+---------------------------------------------------------------------+----------------------+
  28. | :ref:`ImporterMesh<class_ImporterMesh>` | :ref:`importer_mesh<class_GLTFPhysicsShape_property_importer_mesh>` | |
  29. +-----------------------------------------+---------------------------------------------------------------------+----------------------+
  30. | :ref:`bool<class_bool>` | :ref:`is_trigger<class_GLTFPhysicsShape_property_is_trigger>` | ``false`` |
  31. +-----------------------------------------+---------------------------------------------------------------------+----------------------+
  32. | :ref:`int<class_int>` | :ref:`mesh_index<class_GLTFPhysicsShape_property_mesh_index>` | ``-1`` |
  33. +-----------------------------------------+---------------------------------------------------------------------+----------------------+
  34. | :ref:`float<class_float>` | :ref:`radius<class_GLTFPhysicsShape_property_radius>` | ``0.5`` |
  35. +-----------------------------------------+---------------------------------------------------------------------+----------------------+
  36. | :ref:`String<class_String>` | :ref:`shape_type<class_GLTFPhysicsShape_property_shape_type>` | ``""`` |
  37. +-----------------------------------------+---------------------------------------------------------------------+----------------------+
  38. | :ref:`Vector3<class_Vector3>` | :ref:`size<class_GLTFPhysicsShape_property_size>` | ``Vector3(1, 1, 1)`` |
  39. +-----------------------------------------+---------------------------------------------------------------------+----------------------+
  40. .. rst-class:: classref-reftable-group
  41. Methods
  42. -------
  43. .. table::
  44. :widths: auto
  45. +-------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`GLTFPhysicsShape<class_GLTFPhysicsShape>` | :ref:`from_dictionary<class_GLTFPhysicsShape_method_from_dictionary>` **(** :ref:`Dictionary<class_Dictionary>` dictionary **)** |static| |
  47. +-------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`GLTFPhysicsShape<class_GLTFPhysicsShape>` | :ref:`from_node<class_GLTFPhysicsShape_method_from_node>` **(** :ref:`CollisionShape3D<class_CollisionShape3D>` shape_node **)** |static| |
  49. +-------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`Dictionary<class_Dictionary>` | :ref:`to_dictionary<class_GLTFPhysicsShape_method_to_dictionary>` **(** **)** |const| |
  51. +-------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`CollisionShape3D<class_CollisionShape3D>` | :ref:`to_node<class_GLTFPhysicsShape_method_to_node>` **(** :ref:`bool<class_bool>` cache_shapes=false **)** |
  53. +-------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  54. .. rst-class:: classref-section-separator
  55. ----
  56. .. rst-class:: classref-descriptions-group
  57. Property Descriptions
  58. ---------------------
  59. .. _class_GLTFPhysicsShape_property_height:
  60. .. rst-class:: classref-property
  61. :ref:`float<class_float>` **height** = ``2.0``
  62. .. rst-class:: classref-property-setget
  63. - void **set_height** **(** :ref:`float<class_float>` value **)**
  64. - :ref:`float<class_float>` **get_height** **(** **)**
  65. The height of the shape, in meters. This is only used when the shape type is "capsule" or "cylinder". This value should not be negative, and for "capsule" it should be at least twice the radius.
  66. .. rst-class:: classref-item-separator
  67. ----
  68. .. _class_GLTFPhysicsShape_property_importer_mesh:
  69. .. rst-class:: classref-property
  70. :ref:`ImporterMesh<class_ImporterMesh>` **importer_mesh**
  71. .. rst-class:: classref-property-setget
  72. - void **set_importer_mesh** **(** :ref:`ImporterMesh<class_ImporterMesh>` value **)**
  73. - :ref:`ImporterMesh<class_ImporterMesh>` **get_importer_mesh** **(** **)**
  74. The :ref:`ImporterMesh<class_ImporterMesh>` resource of the shape. This is only used when the shape type is "hull" (convex hull) or "trimesh" (concave trimesh).
  75. .. rst-class:: classref-item-separator
  76. ----
  77. .. _class_GLTFPhysicsShape_property_is_trigger:
  78. .. rst-class:: classref-property
  79. :ref:`bool<class_bool>` **is_trigger** = ``false``
  80. .. rst-class:: classref-property-setget
  81. - void **set_is_trigger** **(** :ref:`bool<class_bool>` value **)**
  82. - :ref:`bool<class_bool>` **get_is_trigger** **(** **)**
  83. If ``true``, indicates that this shape is a trigger. For Godot, this means that the shape should be a child of an Area3D node.
  84. This is the only variable not used in the :ref:`to_node<class_GLTFPhysicsShape_method_to_node>` method, it's intended to be used alongside when deciding where to add the generated node as a child.
  85. .. rst-class:: classref-item-separator
  86. ----
  87. .. _class_GLTFPhysicsShape_property_mesh_index:
  88. .. rst-class:: classref-property
  89. :ref:`int<class_int>` **mesh_index** = ``-1``
  90. .. rst-class:: classref-property-setget
  91. - void **set_mesh_index** **(** :ref:`int<class_int>` value **)**
  92. - :ref:`int<class_int>` **get_mesh_index** **(** **)**
  93. The index of the shape's mesh in the GLTF file. This is only used when the shape type is "hull" (convex hull) or "trimesh" (concave trimesh).
  94. .. rst-class:: classref-item-separator
  95. ----
  96. .. _class_GLTFPhysicsShape_property_radius:
  97. .. rst-class:: classref-property
  98. :ref:`float<class_float>` **radius** = ``0.5``
  99. .. rst-class:: classref-property-setget
  100. - void **set_radius** **(** :ref:`float<class_float>` value **)**
  101. - :ref:`float<class_float>` **get_radius** **(** **)**
  102. The radius of the shape, in meters. This is only used when the shape type is "capsule", "cylinder", or "sphere". This value should not be negative.
  103. .. rst-class:: classref-item-separator
  104. ----
  105. .. _class_GLTFPhysicsShape_property_shape_type:
  106. .. rst-class:: classref-property
  107. :ref:`String<class_String>` **shape_type** = ``""``
  108. .. rst-class:: classref-property-setget
  109. - void **set_shape_type** **(** :ref:`String<class_String>` value **)**
  110. - :ref:`String<class_String>` **get_shape_type** **(** **)**
  111. The type of shape this shape represents. Valid values are "box", "capsule", "cylinder", "sphere", "hull", and "trimesh".
  112. .. rst-class:: classref-item-separator
  113. ----
  114. .. _class_GLTFPhysicsShape_property_size:
  115. .. rst-class:: classref-property
  116. :ref:`Vector3<class_Vector3>` **size** = ``Vector3(1, 1, 1)``
  117. .. rst-class:: classref-property-setget
  118. - void **set_size** **(** :ref:`Vector3<class_Vector3>` value **)**
  119. - :ref:`Vector3<class_Vector3>` **get_size** **(** **)**
  120. The size of the shape, in meters. This is only used when the shape type is "box", and it represents the "diameter" of the box. This value should not be negative.
  121. .. rst-class:: classref-section-separator
  122. ----
  123. .. rst-class:: classref-descriptions-group
  124. Method Descriptions
  125. -------------------
  126. .. _class_GLTFPhysicsShape_method_from_dictionary:
  127. .. rst-class:: classref-method
  128. :ref:`GLTFPhysicsShape<class_GLTFPhysicsShape>` **from_dictionary** **(** :ref:`Dictionary<class_Dictionary>` dictionary **)** |static|
  129. Creates a new GLTFPhysicsShape instance by parsing the given :ref:`Dictionary<class_Dictionary>`.
  130. .. rst-class:: classref-item-separator
  131. ----
  132. .. _class_GLTFPhysicsShape_method_from_node:
  133. .. rst-class:: classref-method
  134. :ref:`GLTFPhysicsShape<class_GLTFPhysicsShape>` **from_node** **(** :ref:`CollisionShape3D<class_CollisionShape3D>` shape_node **)** |static|
  135. Create a new GLTFPhysicsShape instance from the given Godot :ref:`CollisionShape3D<class_CollisionShape3D>` node.
  136. .. rst-class:: classref-item-separator
  137. ----
  138. .. _class_GLTFPhysicsShape_method_to_dictionary:
  139. .. rst-class:: classref-method
  140. :ref:`Dictionary<class_Dictionary>` **to_dictionary** **(** **)** |const|
  141. Serializes this GLTFPhysicsShape instance into a :ref:`Dictionary<class_Dictionary>`.
  142. .. rst-class:: classref-item-separator
  143. ----
  144. .. _class_GLTFPhysicsShape_method_to_node:
  145. .. rst-class:: classref-method
  146. :ref:`CollisionShape3D<class_CollisionShape3D>` **to_node** **(** :ref:`bool<class_bool>` cache_shapes=false **)**
  147. Converts this GLTFPhysicsShape instance into a Godot :ref:`CollisionShape3D<class_CollisionShape3D>` node.
  148. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  149. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  150. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  151. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  152. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  153. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  154. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`