class_hingejoint.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the HingeJoint.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_HingeJoint:
  6. HingeJoint
  7. ==========
  8. **Inherits:** :ref:`Joint<class_Joint>` **<** :ref:`Spatial<class_Spatial>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. A hinge between two 3D PhysicsBodies.
  10. Description
  11. -----------
  12. A HingeJoint normally uses the Z axis of body A as the hinge axis, another axis can be specified when adding it manually though. See also :ref:`Generic6DOFJoint<class_Generic6DOFJoint>`.
  13. Properties
  14. ----------
  15. +---------------------------+-------------------------------------------------------------------------------------+-----------+
  16. | :ref:`float<class_float>` | :ref:`angular_limit/bias<class_HingeJoint_property_angular_limit/bias>` | ``0.3`` |
  17. +---------------------------+-------------------------------------------------------------------------------------+-----------+
  18. | :ref:`bool<class_bool>` | :ref:`angular_limit/enable<class_HingeJoint_property_angular_limit/enable>` | ``false`` |
  19. +---------------------------+-------------------------------------------------------------------------------------+-----------+
  20. | :ref:`float<class_float>` | :ref:`angular_limit/lower<class_HingeJoint_property_angular_limit/lower>` | ``-90.0`` |
  21. +---------------------------+-------------------------------------------------------------------------------------+-----------+
  22. | :ref:`float<class_float>` | :ref:`angular_limit/relaxation<class_HingeJoint_property_angular_limit/relaxation>` | ``1.0`` |
  23. +---------------------------+-------------------------------------------------------------------------------------+-----------+
  24. | :ref:`float<class_float>` | :ref:`angular_limit/softness<class_HingeJoint_property_angular_limit/softness>` | ``0.9`` |
  25. +---------------------------+-------------------------------------------------------------------------------------+-----------+
  26. | :ref:`float<class_float>` | :ref:`angular_limit/upper<class_HingeJoint_property_angular_limit/upper>` | ``90.0`` |
  27. +---------------------------+-------------------------------------------------------------------------------------+-----------+
  28. | :ref:`bool<class_bool>` | :ref:`motor/enable<class_HingeJoint_property_motor/enable>` | ``false`` |
  29. +---------------------------+-------------------------------------------------------------------------------------+-----------+
  30. | :ref:`float<class_float>` | :ref:`motor/max_impulse<class_HingeJoint_property_motor/max_impulse>` | ``1.0`` |
  31. +---------------------------+-------------------------------------------------------------------------------------+-----------+
  32. | :ref:`float<class_float>` | :ref:`motor/target_velocity<class_HingeJoint_property_motor/target_velocity>` | ``1.0`` |
  33. +---------------------------+-------------------------------------------------------------------------------------+-----------+
  34. | :ref:`float<class_float>` | :ref:`params/bias<class_HingeJoint_property_params/bias>` | ``0.3`` |
  35. +---------------------------+-------------------------------------------------------------------------------------+-----------+
  36. Methods
  37. -------
  38. +---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`bool<class_bool>` | :ref:`get_flag<class_HingeJoint_method_get_flag>` **(** :ref:`Flag<enum_HingeJoint_Flag>` flag **)** |const| |
  40. +---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`float<class_float>` | :ref:`get_param<class_HingeJoint_method_get_param>` **(** :ref:`Param<enum_HingeJoint_Param>` param **)** |const| |
  42. +---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  43. | void | :ref:`set_flag<class_HingeJoint_method_set_flag>` **(** :ref:`Flag<enum_HingeJoint_Flag>` flag, :ref:`bool<class_bool>` enabled **)** |
  44. +---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  45. | void | :ref:`set_param<class_HingeJoint_method_set_param>` **(** :ref:`Param<enum_HingeJoint_Param>` param, :ref:`float<class_float>` value **)** |
  46. +---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  47. Enumerations
  48. ------------
  49. .. _enum_HingeJoint_Param:
  50. .. _class_HingeJoint_constant_PARAM_BIAS:
  51. .. _class_HingeJoint_constant_PARAM_LIMIT_UPPER:
  52. .. _class_HingeJoint_constant_PARAM_LIMIT_LOWER:
  53. .. _class_HingeJoint_constant_PARAM_LIMIT_BIAS:
  54. .. _class_HingeJoint_constant_PARAM_LIMIT_SOFTNESS:
  55. .. _class_HingeJoint_constant_PARAM_LIMIT_RELAXATION:
  56. .. _class_HingeJoint_constant_PARAM_MOTOR_TARGET_VELOCITY:
  57. .. _class_HingeJoint_constant_PARAM_MOTOR_MAX_IMPULSE:
  58. .. _class_HingeJoint_constant_PARAM_MAX:
  59. enum **Param**:
  60. - **PARAM_BIAS** = **0** --- The speed with which the two bodies get pulled together when they move in different directions.
  61. - **PARAM_LIMIT_UPPER** = **1** --- The maximum rotation. Only active if :ref:`angular_limit/enable<class_HingeJoint_property_angular_limit/enable>` is ``true``.
  62. - **PARAM_LIMIT_LOWER** = **2** --- The minimum rotation. Only active if :ref:`angular_limit/enable<class_HingeJoint_property_angular_limit/enable>` is ``true``.
  63. - **PARAM_LIMIT_BIAS** = **3** --- The speed with which the rotation across the axis perpendicular to the hinge gets corrected.
  64. - **PARAM_LIMIT_SOFTNESS** = **4**
  65. - **PARAM_LIMIT_RELAXATION** = **5** --- The lower this value, the more the rotation gets slowed down.
  66. - **PARAM_MOTOR_TARGET_VELOCITY** = **6** --- Target speed for the motor.
  67. - **PARAM_MOTOR_MAX_IMPULSE** = **7** --- Maximum acceleration for the motor.
  68. - **PARAM_MAX** = **8** --- Represents the size of the :ref:`Param<enum_HingeJoint_Param>` enum.
  69. ----
  70. .. _enum_HingeJoint_Flag:
  71. .. _class_HingeJoint_constant_FLAG_USE_LIMIT:
  72. .. _class_HingeJoint_constant_FLAG_ENABLE_MOTOR:
  73. .. _class_HingeJoint_constant_FLAG_MAX:
  74. enum **Flag**:
  75. - **FLAG_USE_LIMIT** = **0** --- If ``true``, the hinges maximum and minimum rotation, defined by :ref:`angular_limit/lower<class_HingeJoint_property_angular_limit/lower>` and :ref:`angular_limit/upper<class_HingeJoint_property_angular_limit/upper>` has effects.
  76. - **FLAG_ENABLE_MOTOR** = **1** --- When activated, a motor turns the hinge.
  77. - **FLAG_MAX** = **2** --- Represents the size of the :ref:`Flag<enum_HingeJoint_Flag>` enum.
  78. Property Descriptions
  79. ---------------------
  80. .. _class_HingeJoint_property_angular_limit/bias:
  81. - :ref:`float<class_float>` **angular_limit/bias**
  82. +-----------+------------------+
  83. | *Default* | ``0.3`` |
  84. +-----------+------------------+
  85. | *Setter* | set_param(value) |
  86. +-----------+------------------+
  87. | *Getter* | get_param() |
  88. +-----------+------------------+
  89. The speed with which the rotation across the axis perpendicular to the hinge gets corrected.
  90. ----
  91. .. _class_HingeJoint_property_angular_limit/enable:
  92. - :ref:`bool<class_bool>` **angular_limit/enable**
  93. +-----------+-----------------+
  94. | *Default* | ``false`` |
  95. +-----------+-----------------+
  96. | *Setter* | set_flag(value) |
  97. +-----------+-----------------+
  98. | *Getter* | get_flag() |
  99. +-----------+-----------------+
  100. If ``true``, the hinges maximum and minimum rotation, defined by :ref:`angular_limit/lower<class_HingeJoint_property_angular_limit/lower>` and :ref:`angular_limit/upper<class_HingeJoint_property_angular_limit/upper>` has effects.
  101. ----
  102. .. _class_HingeJoint_property_angular_limit/lower:
  103. - :ref:`float<class_float>` **angular_limit/lower**
  104. +-----------+-----------+
  105. | *Default* | ``-90.0`` |
  106. +-----------+-----------+
  107. The minimum rotation. Only active if :ref:`angular_limit/enable<class_HingeJoint_property_angular_limit/enable>` is ``true``.
  108. ----
  109. .. _class_HingeJoint_property_angular_limit/relaxation:
  110. - :ref:`float<class_float>` **angular_limit/relaxation**
  111. +-----------+------------------+
  112. | *Default* | ``1.0`` |
  113. +-----------+------------------+
  114. | *Setter* | set_param(value) |
  115. +-----------+------------------+
  116. | *Getter* | get_param() |
  117. +-----------+------------------+
  118. The lower this value, the more the rotation gets slowed down.
  119. ----
  120. .. _class_HingeJoint_property_angular_limit/softness:
  121. - :ref:`float<class_float>` **angular_limit/softness**
  122. +-----------+------------------+
  123. | *Default* | ``0.9`` |
  124. +-----------+------------------+
  125. | *Setter* | set_param(value) |
  126. +-----------+------------------+
  127. | *Getter* | get_param() |
  128. +-----------+------------------+
  129. ----
  130. .. _class_HingeJoint_property_angular_limit/upper:
  131. - :ref:`float<class_float>` **angular_limit/upper**
  132. +-----------+----------+
  133. | *Default* | ``90.0`` |
  134. +-----------+----------+
  135. The maximum rotation. Only active if :ref:`angular_limit/enable<class_HingeJoint_property_angular_limit/enable>` is ``true``.
  136. ----
  137. .. _class_HingeJoint_property_motor/enable:
  138. - :ref:`bool<class_bool>` **motor/enable**
  139. +-----------+-----------------+
  140. | *Default* | ``false`` |
  141. +-----------+-----------------+
  142. | *Setter* | set_flag(value) |
  143. +-----------+-----------------+
  144. | *Getter* | get_flag() |
  145. +-----------+-----------------+
  146. When activated, a motor turns the hinge.
  147. ----
  148. .. _class_HingeJoint_property_motor/max_impulse:
  149. - :ref:`float<class_float>` **motor/max_impulse**
  150. +-----------+------------------+
  151. | *Default* | ``1.0`` |
  152. +-----------+------------------+
  153. | *Setter* | set_param(value) |
  154. +-----------+------------------+
  155. | *Getter* | get_param() |
  156. +-----------+------------------+
  157. Maximum acceleration for the motor.
  158. ----
  159. .. _class_HingeJoint_property_motor/target_velocity:
  160. - :ref:`float<class_float>` **motor/target_velocity**
  161. +-----------+------------------+
  162. | *Default* | ``1.0`` |
  163. +-----------+------------------+
  164. | *Setter* | set_param(value) |
  165. +-----------+------------------+
  166. | *Getter* | get_param() |
  167. +-----------+------------------+
  168. Target speed for the motor.
  169. ----
  170. .. _class_HingeJoint_property_params/bias:
  171. - :ref:`float<class_float>` **params/bias**
  172. +-----------+------------------+
  173. | *Default* | ``0.3`` |
  174. +-----------+------------------+
  175. | *Setter* | set_param(value) |
  176. +-----------+------------------+
  177. | *Getter* | get_param() |
  178. +-----------+------------------+
  179. The speed with which the two bodies get pulled together when they move in different directions.
  180. Method Descriptions
  181. -------------------
  182. .. _class_HingeJoint_method_get_flag:
  183. - :ref:`bool<class_bool>` **get_flag** **(** :ref:`Flag<enum_HingeJoint_Flag>` flag **)** |const|
  184. Returns the value of the specified flag.
  185. ----
  186. .. _class_HingeJoint_method_get_param:
  187. - :ref:`float<class_float>` **get_param** **(** :ref:`Param<enum_HingeJoint_Param>` param **)** |const|
  188. Returns the value of the specified parameter.
  189. ----
  190. .. _class_HingeJoint_method_set_flag:
  191. - void **set_flag** **(** :ref:`Flag<enum_HingeJoint_Flag>` flag, :ref:`bool<class_bool>` enabled **)**
  192. If ``true``, enables the specified flag.
  193. ----
  194. .. _class_HingeJoint_method_set_param:
  195. - void **set_param** **(** :ref:`Param<enum_HingeJoint_Param>` param, :ref:`float<class_float>` value **)**
  196. Sets the value of the specified parameter.
  197. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  198. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  199. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`