class_gltfphysicsbody.rst 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  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/GLTFPhysicsBody.xml.
  6. .. _class_GLTFPhysicsBody:
  7. GLTFPhysicsBody
  8. ===============
  9. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Represents a glTF physics body.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Represents a physics body as an intermediary between the ``OMI_physics_body`` 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_body glTF extension <https://github.com/omigroup/gltf-extensions/tree/main/extensions/2.0/OMI_physics_body>`__
  20. .. rst-class:: classref-reftable-group
  21. Properties
  22. ----------
  23. .. table::
  24. :widths: auto
  25. +-------------------------------------+--------------------------------------------------------------------------------+--------------------------------------+
  26. | :ref:`Vector3<class_Vector3>` | :ref:`angular_velocity<class_GLTFPhysicsBody_property_angular_velocity>` | ``Vector3(0, 0, 0)`` |
  27. +-------------------------------------+--------------------------------------------------------------------------------+--------------------------------------+
  28. | :ref:`String<class_String>` | :ref:`body_type<class_GLTFPhysicsBody_property_body_type>` | ``"rigid"`` |
  29. +-------------------------------------+--------------------------------------------------------------------------------+--------------------------------------+
  30. | :ref:`Vector3<class_Vector3>` | :ref:`center_of_mass<class_GLTFPhysicsBody_property_center_of_mass>` | ``Vector3(0, 0, 0)`` |
  31. +-------------------------------------+--------------------------------------------------------------------------------+--------------------------------------+
  32. | :ref:`Vector3<class_Vector3>` | :ref:`inertia_diagonal<class_GLTFPhysicsBody_property_inertia_diagonal>` | ``Vector3(0, 0, 0)`` |
  33. +-------------------------------------+--------------------------------------------------------------------------------+--------------------------------------+
  34. | :ref:`Quaternion<class_Quaternion>` | :ref:`inertia_orientation<class_GLTFPhysicsBody_property_inertia_orientation>` | ``Quaternion(0, 0, 0, 1)`` |
  35. +-------------------------------------+--------------------------------------------------------------------------------+--------------------------------------+
  36. | :ref:`Basis<class_Basis>` | :ref:`inertia_tensor<class_GLTFPhysicsBody_property_inertia_tensor>` | ``Basis(0, 0, 0, 0, 0, 0, 0, 0, 0)`` |
  37. +-------------------------------------+--------------------------------------------------------------------------------+--------------------------------------+
  38. | :ref:`Vector3<class_Vector3>` | :ref:`linear_velocity<class_GLTFPhysicsBody_property_linear_velocity>` | ``Vector3(0, 0, 0)`` |
  39. +-------------------------------------+--------------------------------------------------------------------------------+--------------------------------------+
  40. | :ref:`float<class_float>` | :ref:`mass<class_GLTFPhysicsBody_property_mass>` | ``1.0`` |
  41. +-------------------------------------+--------------------------------------------------------------------------------+--------------------------------------+
  42. .. rst-class:: classref-reftable-group
  43. Methods
  44. -------
  45. .. table::
  46. :widths: auto
  47. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`GLTFPhysicsBody<class_GLTFPhysicsBody>` | :ref:`from_dictionary<class_GLTFPhysicsBody_method_from_dictionary>`\ (\ dictionary\: :ref:`Dictionary<class_Dictionary>`\ ) |static| |
  49. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`GLTFPhysicsBody<class_GLTFPhysicsBody>` | :ref:`from_node<class_GLTFPhysicsBody_method_from_node>`\ (\ body_node\: :ref:`CollisionObject3D<class_CollisionObject3D>`\ ) |static| |
  51. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`Dictionary<class_Dictionary>` | :ref:`to_dictionary<class_GLTFPhysicsBody_method_to_dictionary>`\ (\ ) |const| |
  53. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  54. | :ref:`CollisionObject3D<class_CollisionObject3D>` | :ref:`to_node<class_GLTFPhysicsBody_method_to_node>`\ (\ ) |const| |
  55. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  56. .. rst-class:: classref-section-separator
  57. ----
  58. .. rst-class:: classref-descriptions-group
  59. Property Descriptions
  60. ---------------------
  61. .. _class_GLTFPhysicsBody_property_angular_velocity:
  62. .. rst-class:: classref-property
  63. :ref:`Vector3<class_Vector3>` **angular_velocity** = ``Vector3(0, 0, 0)`` :ref:`🔗<class_GLTFPhysicsBody_property_angular_velocity>`
  64. .. rst-class:: classref-property-setget
  65. - |void| **set_angular_velocity**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
  66. - :ref:`Vector3<class_Vector3>` **get_angular_velocity**\ (\ )
  67. The angular velocity of the physics body, in radians per second. This is only used when the body type is "rigid" or "vehicle".
  68. .. rst-class:: classref-item-separator
  69. ----
  70. .. _class_GLTFPhysicsBody_property_body_type:
  71. .. rst-class:: classref-property
  72. :ref:`String<class_String>` **body_type** = ``"rigid"`` :ref:`🔗<class_GLTFPhysicsBody_property_body_type>`
  73. .. rst-class:: classref-property-setget
  74. - |void| **set_body_type**\ (\ value\: :ref:`String<class_String>`\ )
  75. - :ref:`String<class_String>` **get_body_type**\ (\ )
  76. The type of the body. When importing, this controls what type of :ref:`CollisionObject3D<class_CollisionObject3D>` node Godot should generate. Valid values are "static", "animatable", "character", "rigid", "vehicle", and "trigger". When exporting, this will be squashed down to one of "static", "kinematic", or "dynamic" motion types, or the "trigger" property.
  77. .. rst-class:: classref-item-separator
  78. ----
  79. .. _class_GLTFPhysicsBody_property_center_of_mass:
  80. .. rst-class:: classref-property
  81. :ref:`Vector3<class_Vector3>` **center_of_mass** = ``Vector3(0, 0, 0)`` :ref:`🔗<class_GLTFPhysicsBody_property_center_of_mass>`
  82. .. rst-class:: classref-property-setget
  83. - |void| **set_center_of_mass**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
  84. - :ref:`Vector3<class_Vector3>` **get_center_of_mass**\ (\ )
  85. The center of mass of the body, in meters. This is in local space relative to the body. By default, the center of the mass is the body's origin.
  86. .. rst-class:: classref-item-separator
  87. ----
  88. .. _class_GLTFPhysicsBody_property_inertia_diagonal:
  89. .. rst-class:: classref-property
  90. :ref:`Vector3<class_Vector3>` **inertia_diagonal** = ``Vector3(0, 0, 0)`` :ref:`🔗<class_GLTFPhysicsBody_property_inertia_diagonal>`
  91. .. rst-class:: classref-property-setget
  92. - |void| **set_inertia_diagonal**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
  93. - :ref:`Vector3<class_Vector3>` **get_inertia_diagonal**\ (\ )
  94. The inertia strength of the physics body, in kilogram meter squared (kg⋅m²). This represents the inertia around the principle axes, the diagonal of the inertia tensor matrix. This is only used when the body type is "rigid" or "vehicle".
  95. When converted to a Godot :ref:`RigidBody3D<class_RigidBody3D>` node, if this value is zero, then the inertia will be calculated automatically.
  96. .. rst-class:: classref-item-separator
  97. ----
  98. .. _class_GLTFPhysicsBody_property_inertia_orientation:
  99. .. rst-class:: classref-property
  100. :ref:`Quaternion<class_Quaternion>` **inertia_orientation** = ``Quaternion(0, 0, 0, 1)`` :ref:`🔗<class_GLTFPhysicsBody_property_inertia_orientation>`
  101. .. rst-class:: classref-property-setget
  102. - |void| **set_inertia_orientation**\ (\ value\: :ref:`Quaternion<class_Quaternion>`\ )
  103. - :ref:`Quaternion<class_Quaternion>` **get_inertia_orientation**\ (\ )
  104. The inertia orientation of the physics body. This defines the rotation of the inertia's principle axes relative to the object's local axes. This is only used when the body type is "rigid" or "vehicle" and :ref:`inertia_diagonal<class_GLTFPhysicsBody_property_inertia_diagonal>` is set to a non-zero value.
  105. .. rst-class:: classref-item-separator
  106. ----
  107. .. _class_GLTFPhysicsBody_property_inertia_tensor:
  108. .. rst-class:: classref-property
  109. :ref:`Basis<class_Basis>` **inertia_tensor** = ``Basis(0, 0, 0, 0, 0, 0, 0, 0, 0)`` :ref:`🔗<class_GLTFPhysicsBody_property_inertia_tensor>`
  110. .. rst-class:: classref-property-setget
  111. - |void| **set_inertia_tensor**\ (\ value\: :ref:`Basis<class_Basis>`\ )
  112. - :ref:`Basis<class_Basis>` **get_inertia_tensor**\ (\ )
  113. **Deprecated:** This property may be changed or removed in future versions.
  114. The inertia tensor of the physics body, in kilogram meter squared (kg⋅m²). This is only used when the body type is "rigid" or "vehicle".
  115. When converted to a Godot :ref:`RigidBody3D<class_RigidBody3D>` node, if this value is zero, then the inertia will be calculated automatically.
  116. .. rst-class:: classref-item-separator
  117. ----
  118. .. _class_GLTFPhysicsBody_property_linear_velocity:
  119. .. rst-class:: classref-property
  120. :ref:`Vector3<class_Vector3>` **linear_velocity** = ``Vector3(0, 0, 0)`` :ref:`🔗<class_GLTFPhysicsBody_property_linear_velocity>`
  121. .. rst-class:: classref-property-setget
  122. - |void| **set_linear_velocity**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
  123. - :ref:`Vector3<class_Vector3>` **get_linear_velocity**\ (\ )
  124. The linear velocity of the physics body, in meters per second. This is only used when the body type is "rigid" or "vehicle".
  125. .. rst-class:: classref-item-separator
  126. ----
  127. .. _class_GLTFPhysicsBody_property_mass:
  128. .. rst-class:: classref-property
  129. :ref:`float<class_float>` **mass** = ``1.0`` :ref:`🔗<class_GLTFPhysicsBody_property_mass>`
  130. .. rst-class:: classref-property-setget
  131. - |void| **set_mass**\ (\ value\: :ref:`float<class_float>`\ )
  132. - :ref:`float<class_float>` **get_mass**\ (\ )
  133. The mass of the physics body, in kilograms. This is only used when the body type is "rigid" or "vehicle".
  134. .. rst-class:: classref-section-separator
  135. ----
  136. .. rst-class:: classref-descriptions-group
  137. Method Descriptions
  138. -------------------
  139. .. _class_GLTFPhysicsBody_method_from_dictionary:
  140. .. rst-class:: classref-method
  141. :ref:`GLTFPhysicsBody<class_GLTFPhysicsBody>` **from_dictionary**\ (\ dictionary\: :ref:`Dictionary<class_Dictionary>`\ ) |static| :ref:`🔗<class_GLTFPhysicsBody_method_from_dictionary>`
  142. Creates a new GLTFPhysicsBody instance by parsing the given :ref:`Dictionary<class_Dictionary>` in the ``OMI_physics_body`` glTF extension format.
  143. .. rst-class:: classref-item-separator
  144. ----
  145. .. _class_GLTFPhysicsBody_method_from_node:
  146. .. rst-class:: classref-method
  147. :ref:`GLTFPhysicsBody<class_GLTFPhysicsBody>` **from_node**\ (\ body_node\: :ref:`CollisionObject3D<class_CollisionObject3D>`\ ) |static| :ref:`🔗<class_GLTFPhysicsBody_method_from_node>`
  148. Creates a new GLTFPhysicsBody instance from the given Godot :ref:`CollisionObject3D<class_CollisionObject3D>` node.
  149. .. rst-class:: classref-item-separator
  150. ----
  151. .. _class_GLTFPhysicsBody_method_to_dictionary:
  152. .. rst-class:: classref-method
  153. :ref:`Dictionary<class_Dictionary>` **to_dictionary**\ (\ ) |const| :ref:`🔗<class_GLTFPhysicsBody_method_to_dictionary>`
  154. Serializes this GLTFPhysicsBody instance into a :ref:`Dictionary<class_Dictionary>`. It will be in the format expected by the ``OMI_physics_body`` glTF extension.
  155. .. rst-class:: classref-item-separator
  156. ----
  157. .. _class_GLTFPhysicsBody_method_to_node:
  158. .. rst-class:: classref-method
  159. :ref:`CollisionObject3D<class_CollisionObject3D>` **to_node**\ (\ ) |const| :ref:`🔗<class_GLTFPhysicsBody_method_to_node>`
  160. Converts this GLTFPhysicsBody instance into a Godot :ref:`CollisionObject3D<class_CollisionObject3D>` node.
  161. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  162. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  163. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  164. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  165. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  166. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  167. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  168. .. |void| replace:: :abbr:`void (No return value.)`