class_gltfphysicsshape.rst 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  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/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_physics_shape`` or ``OMI_collider`` glTF extensions. 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_physics_shape glTF extension <https://github.com/omigroup/gltf-extensions/tree/main/extensions/2.0/OMI_physics_shape>`__
  20. - `OMI_collider glTF extension <https://github.com/omigroup/gltf-extensions/tree/main/extensions/2.0/Archived/OMI_collider>`__
  21. .. rst-class:: classref-reftable-group
  22. Properties
  23. ----------
  24. .. table::
  25. :widths: auto
  26. +-----------------------------------------+---------------------------------------------------------------------+----------------------+
  27. | :ref:`float<class_float>` | :ref:`height<class_GLTFPhysicsShape_property_height>` | ``2.0`` |
  28. +-----------------------------------------+---------------------------------------------------------------------+----------------------+
  29. | :ref:`ImporterMesh<class_ImporterMesh>` | :ref:`importer_mesh<class_GLTFPhysicsShape_property_importer_mesh>` | |
  30. +-----------------------------------------+---------------------------------------------------------------------+----------------------+
  31. | :ref:`bool<class_bool>` | :ref:`is_trigger<class_GLTFPhysicsShape_property_is_trigger>` | ``false`` |
  32. +-----------------------------------------+---------------------------------------------------------------------+----------------------+
  33. | :ref:`int<class_int>` | :ref:`mesh_index<class_GLTFPhysicsShape_property_mesh_index>` | ``-1`` |
  34. +-----------------------------------------+---------------------------------------------------------------------+----------------------+
  35. | :ref:`float<class_float>` | :ref:`radius<class_GLTFPhysicsShape_property_radius>` | ``0.5`` |
  36. +-----------------------------------------+---------------------------------------------------------------------+----------------------+
  37. | :ref:`String<class_String>` | :ref:`shape_type<class_GLTFPhysicsShape_property_shape_type>` | ``""`` |
  38. +-----------------------------------------+---------------------------------------------------------------------+----------------------+
  39. | :ref:`Vector3<class_Vector3>` | :ref:`size<class_GLTFPhysicsShape_property_size>` | ``Vector3(1, 1, 1)`` |
  40. +-----------------------------------------+---------------------------------------------------------------------+----------------------+
  41. .. rst-class:: classref-reftable-group
  42. Methods
  43. -------
  44. .. table::
  45. :widths: auto
  46. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`GLTFPhysicsShape<class_GLTFPhysicsShape>` | :ref:`from_dictionary<class_GLTFPhysicsShape_method_from_dictionary>`\ (\ dictionary\: :ref:`Dictionary<class_Dictionary>`\ ) |static| |
  48. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`GLTFPhysicsShape<class_GLTFPhysicsShape>` | :ref:`from_node<class_GLTFPhysicsShape_method_from_node>`\ (\ shape_node\: :ref:`CollisionShape3D<class_CollisionShape3D>`\ ) |static| |
  50. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`GLTFPhysicsShape<class_GLTFPhysicsShape>` | :ref:`from_resource<class_GLTFPhysicsShape_method_from_resource>`\ (\ shape_resource\: :ref:`Shape3D<class_Shape3D>`\ ) |static| |
  52. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`Dictionary<class_Dictionary>` | :ref:`to_dictionary<class_GLTFPhysicsShape_method_to_dictionary>`\ (\ ) |const| |
  54. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`CollisionShape3D<class_CollisionShape3D>` | :ref:`to_node<class_GLTFPhysicsShape_method_to_node>`\ (\ cache_shapes\: :ref:`bool<class_bool>` = false\ ) |
  56. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  57. | :ref:`Shape3D<class_Shape3D>` | :ref:`to_resource<class_GLTFPhysicsShape_method_to_resource>`\ (\ cache_shapes\: :ref:`bool<class_bool>` = false\ ) |
  58. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  59. .. rst-class:: classref-section-separator
  60. ----
  61. .. rst-class:: classref-descriptions-group
  62. Property Descriptions
  63. ---------------------
  64. .. _class_GLTFPhysicsShape_property_height:
  65. .. rst-class:: classref-property
  66. :ref:`float<class_float>` **height** = ``2.0`` :ref:`🔗<class_GLTFPhysicsShape_property_height>`
  67. .. rst-class:: classref-property-setget
  68. - |void| **set_height**\ (\ value\: :ref:`float<class_float>`\ )
  69. - :ref:`float<class_float>` **get_height**\ (\ )
  70. 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.
  71. .. rst-class:: classref-item-separator
  72. ----
  73. .. _class_GLTFPhysicsShape_property_importer_mesh:
  74. .. rst-class:: classref-property
  75. :ref:`ImporterMesh<class_ImporterMesh>` **importer_mesh** :ref:`🔗<class_GLTFPhysicsShape_property_importer_mesh>`
  76. .. rst-class:: classref-property-setget
  77. - |void| **set_importer_mesh**\ (\ value\: :ref:`ImporterMesh<class_ImporterMesh>`\ )
  78. - :ref:`ImporterMesh<class_ImporterMesh>` **get_importer_mesh**\ (\ )
  79. 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).
  80. .. rst-class:: classref-item-separator
  81. ----
  82. .. _class_GLTFPhysicsShape_property_is_trigger:
  83. .. rst-class:: classref-property
  84. :ref:`bool<class_bool>` **is_trigger** = ``false`` :ref:`🔗<class_GLTFPhysicsShape_property_is_trigger>`
  85. .. rst-class:: classref-property-setget
  86. - |void| **set_is_trigger**\ (\ value\: :ref:`bool<class_bool>`\ )
  87. - :ref:`bool<class_bool>` **get_is_trigger**\ (\ )
  88. If ``true``, indicates that this shape is a trigger. For Godot, this means that the shape should be a child of an :ref:`Area3D<class_Area3D>` node.
  89. 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.
  90. .. rst-class:: classref-item-separator
  91. ----
  92. .. _class_GLTFPhysicsShape_property_mesh_index:
  93. .. rst-class:: classref-property
  94. :ref:`int<class_int>` **mesh_index** = ``-1`` :ref:`🔗<class_GLTFPhysicsShape_property_mesh_index>`
  95. .. rst-class:: classref-property-setget
  96. - |void| **set_mesh_index**\ (\ value\: :ref:`int<class_int>`\ )
  97. - :ref:`int<class_int>` **get_mesh_index**\ (\ )
  98. 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).
  99. .. rst-class:: classref-item-separator
  100. ----
  101. .. _class_GLTFPhysicsShape_property_radius:
  102. .. rst-class:: classref-property
  103. :ref:`float<class_float>` **radius** = ``0.5`` :ref:`🔗<class_GLTFPhysicsShape_property_radius>`
  104. .. rst-class:: classref-property-setget
  105. - |void| **set_radius**\ (\ value\: :ref:`float<class_float>`\ )
  106. - :ref:`float<class_float>` **get_radius**\ (\ )
  107. 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.
  108. .. rst-class:: classref-item-separator
  109. ----
  110. .. _class_GLTFPhysicsShape_property_shape_type:
  111. .. rst-class:: classref-property
  112. :ref:`String<class_String>` **shape_type** = ``""`` :ref:`🔗<class_GLTFPhysicsShape_property_shape_type>`
  113. .. rst-class:: classref-property-setget
  114. - |void| **set_shape_type**\ (\ value\: :ref:`String<class_String>`\ )
  115. - :ref:`String<class_String>` **get_shape_type**\ (\ )
  116. The type of shape this shape represents. Valid values are ``"box"``, ``"capsule"``, ``"cylinder"``, ``"sphere"``, ``"hull"``, and ``"trimesh"``.
  117. .. rst-class:: classref-item-separator
  118. ----
  119. .. _class_GLTFPhysicsShape_property_size:
  120. .. rst-class:: classref-property
  121. :ref:`Vector3<class_Vector3>` **size** = ``Vector3(1, 1, 1)`` :ref:`🔗<class_GLTFPhysicsShape_property_size>`
  122. .. rst-class:: classref-property-setget
  123. - |void| **set_size**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
  124. - :ref:`Vector3<class_Vector3>` **get_size**\ (\ )
  125. 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.
  126. .. rst-class:: classref-section-separator
  127. ----
  128. .. rst-class:: classref-descriptions-group
  129. Method Descriptions
  130. -------------------
  131. .. _class_GLTFPhysicsShape_method_from_dictionary:
  132. .. rst-class:: classref-method
  133. :ref:`GLTFPhysicsShape<class_GLTFPhysicsShape>` **from_dictionary**\ (\ dictionary\: :ref:`Dictionary<class_Dictionary>`\ ) |static| :ref:`🔗<class_GLTFPhysicsShape_method_from_dictionary>`
  134. Creates a new GLTFPhysicsShape instance by parsing the given :ref:`Dictionary<class_Dictionary>`.
  135. .. rst-class:: classref-item-separator
  136. ----
  137. .. _class_GLTFPhysicsShape_method_from_node:
  138. .. rst-class:: classref-method
  139. :ref:`GLTFPhysicsShape<class_GLTFPhysicsShape>` **from_node**\ (\ shape_node\: :ref:`CollisionShape3D<class_CollisionShape3D>`\ ) |static| :ref:`🔗<class_GLTFPhysicsShape_method_from_node>`
  140. Creates a new GLTFPhysicsShape instance from the given Godot :ref:`CollisionShape3D<class_CollisionShape3D>` node.
  141. .. rst-class:: classref-item-separator
  142. ----
  143. .. _class_GLTFPhysicsShape_method_from_resource:
  144. .. rst-class:: classref-method
  145. :ref:`GLTFPhysicsShape<class_GLTFPhysicsShape>` **from_resource**\ (\ shape_resource\: :ref:`Shape3D<class_Shape3D>`\ ) |static| :ref:`🔗<class_GLTFPhysicsShape_method_from_resource>`
  146. Creates a new GLTFPhysicsShape instance from the given Godot :ref:`Shape3D<class_Shape3D>` resource.
  147. .. rst-class:: classref-item-separator
  148. ----
  149. .. _class_GLTFPhysicsShape_method_to_dictionary:
  150. .. rst-class:: classref-method
  151. :ref:`Dictionary<class_Dictionary>` **to_dictionary**\ (\ ) |const| :ref:`🔗<class_GLTFPhysicsShape_method_to_dictionary>`
  152. Serializes this GLTFPhysicsShape instance into a :ref:`Dictionary<class_Dictionary>` in the format defined by ``OMI_physics_shape``.
  153. .. rst-class:: classref-item-separator
  154. ----
  155. .. _class_GLTFPhysicsShape_method_to_node:
  156. .. rst-class:: classref-method
  157. :ref:`CollisionShape3D<class_CollisionShape3D>` **to_node**\ (\ cache_shapes\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_GLTFPhysicsShape_method_to_node>`
  158. Converts this GLTFPhysicsShape instance into a Godot :ref:`CollisionShape3D<class_CollisionShape3D>` node.
  159. .. rst-class:: classref-item-separator
  160. ----
  161. .. _class_GLTFPhysicsShape_method_to_resource:
  162. .. rst-class:: classref-method
  163. :ref:`Shape3D<class_Shape3D>` **to_resource**\ (\ cache_shapes\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_GLTFPhysicsShape_method_to_resource>`
  164. Converts this GLTFPhysicsShape instance into a Godot :ref:`Shape3D<class_Shape3D>` resource.
  165. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  166. .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
  167. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  168. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  169. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  170. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  171. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  172. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  173. .. |void| replace:: :abbr:`void (No return value.)`