class_physicalbone3d.rst 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  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 PhysicalBone3D.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_PhysicalBone3D:
  6. PhysicalBone3D
  7. ==============
  8. **Inherits:** :ref:`PhysicsBody3D<class_PhysicsBody3D>` **<** :ref:`CollisionObject3D<class_CollisionObject3D>` **<** :ref:`Node3D<class_Node3D>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. Properties
  10. ----------
  11. +-------------------------------------------------+---------------------------------------------------------------------------+-----------------------------------------------------+
  12. | :ref:`float<class_float>` | :ref:`angular_damp<class_PhysicalBone3D_property_angular_damp>` | ``0.0`` |
  13. +-------------------------------------------------+---------------------------------------------------------------------------+-----------------------------------------------------+
  14. | :ref:`DampMode<enum_PhysicalBone3D_DampMode>` | :ref:`angular_damp_mode<class_PhysicalBone3D_property_angular_damp_mode>` | ``0`` |
  15. +-------------------------------------------------+---------------------------------------------------------------------------+-----------------------------------------------------+
  16. | :ref:`Vector3<class_Vector3>` | :ref:`angular_velocity<class_PhysicalBone3D_property_angular_velocity>` | ``Vector3(0, 0, 0)`` |
  17. +-------------------------------------------------+---------------------------------------------------------------------------+-----------------------------------------------------+
  18. | :ref:`Transform3D<class_Transform3D>` | :ref:`body_offset<class_PhysicalBone3D_property_body_offset>` | ``Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)`` |
  19. +-------------------------------------------------+---------------------------------------------------------------------------+-----------------------------------------------------+
  20. | :ref:`float<class_float>` | :ref:`bounce<class_PhysicalBone3D_property_bounce>` | ``0.0`` |
  21. +-------------------------------------------------+---------------------------------------------------------------------------+-----------------------------------------------------+
  22. | :ref:`bool<class_bool>` | :ref:`can_sleep<class_PhysicalBone3D_property_can_sleep>` | ``true`` |
  23. +-------------------------------------------------+---------------------------------------------------------------------------+-----------------------------------------------------+
  24. | :ref:`bool<class_bool>` | :ref:`custom_integrator<class_PhysicalBone3D_property_custom_integrator>` | ``false`` |
  25. +-------------------------------------------------+---------------------------------------------------------------------------+-----------------------------------------------------+
  26. | :ref:`float<class_float>` | :ref:`friction<class_PhysicalBone3D_property_friction>` | ``1.0`` |
  27. +-------------------------------------------------+---------------------------------------------------------------------------+-----------------------------------------------------+
  28. | :ref:`float<class_float>` | :ref:`gravity_scale<class_PhysicalBone3D_property_gravity_scale>` | ``1.0`` |
  29. +-------------------------------------------------+---------------------------------------------------------------------------+-----------------------------------------------------+
  30. | :ref:`Transform3D<class_Transform3D>` | :ref:`joint_offset<class_PhysicalBone3D_property_joint_offset>` | ``Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)`` |
  31. +-------------------------------------------------+---------------------------------------------------------------------------+-----------------------------------------------------+
  32. | :ref:`Vector3<class_Vector3>` | :ref:`joint_rotation<class_PhysicalBone3D_property_joint_rotation>` | ``Vector3(0, 0, 0)`` |
  33. +-------------------------------------------------+---------------------------------------------------------------------------+-----------------------------------------------------+
  34. | :ref:`JointType<enum_PhysicalBone3D_JointType>` | :ref:`joint_type<class_PhysicalBone3D_property_joint_type>` | ``0`` |
  35. +-------------------------------------------------+---------------------------------------------------------------------------+-----------------------------------------------------+
  36. | :ref:`float<class_float>` | :ref:`linear_damp<class_PhysicalBone3D_property_linear_damp>` | ``0.0`` |
  37. +-------------------------------------------------+---------------------------------------------------------------------------+-----------------------------------------------------+
  38. | :ref:`DampMode<enum_PhysicalBone3D_DampMode>` | :ref:`linear_damp_mode<class_PhysicalBone3D_property_linear_damp_mode>` | ``0`` |
  39. +-------------------------------------------------+---------------------------------------------------------------------------+-----------------------------------------------------+
  40. | :ref:`Vector3<class_Vector3>` | :ref:`linear_velocity<class_PhysicalBone3D_property_linear_velocity>` | ``Vector3(0, 0, 0)`` |
  41. +-------------------------------------------------+---------------------------------------------------------------------------+-----------------------------------------------------+
  42. | :ref:`float<class_float>` | :ref:`mass<class_PhysicalBone3D_property_mass>` | ``1.0`` |
  43. +-------------------------------------------------+---------------------------------------------------------------------------+-----------------------------------------------------+
  44. Methods
  45. -------
  46. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | void | :ref:`_integrate_forces<class_PhysicalBone3D_method__integrate_forces>` **(** :ref:`PhysicsDirectBodyState3D<class_PhysicsDirectBodyState3D>` state **)** |virtual| |
  48. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | void | :ref:`apply_central_impulse<class_PhysicalBone3D_method_apply_central_impulse>` **(** :ref:`Vector3<class_Vector3>` impulse **)** |
  50. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | void | :ref:`apply_impulse<class_PhysicalBone3D_method_apply_impulse>` **(** :ref:`Vector3<class_Vector3>` impulse, :ref:`Vector3<class_Vector3>` position=Vector3(0, 0, 0) **)** |
  52. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`int<class_int>` | :ref:`get_bone_id<class_PhysicalBone3D_method_get_bone_id>` **(** **)** |const| |
  54. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`bool<class_bool>` | :ref:`get_simulate_physics<class_PhysicalBone3D_method_get_simulate_physics>` **(** **)** |
  56. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | :ref:`bool<class_bool>` | :ref:`is_simulating_physics<class_PhysicalBone3D_method_is_simulating_physics>` **(** **)** |
  58. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. Enumerations
  60. ------------
  61. .. _enum_PhysicalBone3D_DampMode:
  62. .. _class_PhysicalBone3D_constant_DAMP_MODE_COMBINE:
  63. .. _class_PhysicalBone3D_constant_DAMP_MODE_REPLACE:
  64. enum **DampMode**:
  65. - **DAMP_MODE_COMBINE** = **0** --- In this mode, the body's damping value is added to any value set in areas or the default value.
  66. - **DAMP_MODE_REPLACE** = **1** --- In this mode, the body's damping value replaces any value set in areas or the default value.
  67. ----
  68. .. _enum_PhysicalBone3D_JointType:
  69. .. _class_PhysicalBone3D_constant_JOINT_TYPE_NONE:
  70. .. _class_PhysicalBone3D_constant_JOINT_TYPE_PIN:
  71. .. _class_PhysicalBone3D_constant_JOINT_TYPE_CONE:
  72. .. _class_PhysicalBone3D_constant_JOINT_TYPE_HINGE:
  73. .. _class_PhysicalBone3D_constant_JOINT_TYPE_SLIDER:
  74. .. _class_PhysicalBone3D_constant_JOINT_TYPE_6DOF:
  75. enum **JointType**:
  76. - **JOINT_TYPE_NONE** = **0**
  77. - **JOINT_TYPE_PIN** = **1**
  78. - **JOINT_TYPE_CONE** = **2**
  79. - **JOINT_TYPE_HINGE** = **3**
  80. - **JOINT_TYPE_SLIDER** = **4**
  81. - **JOINT_TYPE_6DOF** = **5**
  82. Property Descriptions
  83. ---------------------
  84. .. _class_PhysicalBone3D_property_angular_damp:
  85. - :ref:`float<class_float>` **angular_damp**
  86. +-----------+-------------------------+
  87. | *Default* | ``0.0`` |
  88. +-----------+-------------------------+
  89. | *Setter* | set_angular_damp(value) |
  90. +-----------+-------------------------+
  91. | *Getter* | get_angular_damp() |
  92. +-----------+-------------------------+
  93. Damps the body's rotation. By default, the body will use the **Default Angular Damp** in **Project > Project Settings > Physics > 3d** or any value override set by an :ref:`Area3D<class_Area3D>` the body is in. Depending on :ref:`angular_damp_mode<class_PhysicalBone3D_property_angular_damp_mode>`, you can set :ref:`angular_damp<class_PhysicalBone3D_property_angular_damp>` to be added to or to replace the body's damping value.
  94. See :ref:`ProjectSettings.physics/3d/default_angular_damp<class_ProjectSettings_property_physics/3d/default_angular_damp>` for more details about damping.
  95. ----
  96. .. _class_PhysicalBone3D_property_angular_damp_mode:
  97. - :ref:`DampMode<enum_PhysicalBone3D_DampMode>` **angular_damp_mode**
  98. +-----------+------------------------------+
  99. | *Default* | ``0`` |
  100. +-----------+------------------------------+
  101. | *Setter* | set_angular_damp_mode(value) |
  102. +-----------+------------------------------+
  103. | *Getter* | get_angular_damp_mode() |
  104. +-----------+------------------------------+
  105. Defines how :ref:`angular_damp<class_PhysicalBone3D_property_angular_damp>` is applied. See :ref:`DampMode<enum_PhysicalBone3D_DampMode>` for possible values.
  106. ----
  107. .. _class_PhysicalBone3D_property_angular_velocity:
  108. - :ref:`Vector3<class_Vector3>` **angular_velocity**
  109. +-----------+-----------------------------+
  110. | *Default* | ``Vector3(0, 0, 0)`` |
  111. +-----------+-----------------------------+
  112. | *Setter* | set_angular_velocity(value) |
  113. +-----------+-----------------------------+
  114. | *Getter* | get_angular_velocity() |
  115. +-----------+-----------------------------+
  116. The PhysicalBone3D's rotational velocity in *radians* per second.
  117. ----
  118. .. _class_PhysicalBone3D_property_body_offset:
  119. - :ref:`Transform3D<class_Transform3D>` **body_offset**
  120. +-----------+-----------------------------------------------------+
  121. | *Default* | ``Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)`` |
  122. +-----------+-----------------------------------------------------+
  123. | *Setter* | set_body_offset(value) |
  124. +-----------+-----------------------------------------------------+
  125. | *Getter* | get_body_offset() |
  126. +-----------+-----------------------------------------------------+
  127. Sets the body's transform.
  128. ----
  129. .. _class_PhysicalBone3D_property_bounce:
  130. - :ref:`float<class_float>` **bounce**
  131. +-----------+-------------------+
  132. | *Default* | ``0.0`` |
  133. +-----------+-------------------+
  134. | *Setter* | set_bounce(value) |
  135. +-----------+-------------------+
  136. | *Getter* | get_bounce() |
  137. +-----------+-------------------+
  138. The body's bounciness. Values range from ``0`` (no bounce) to ``1`` (full bounciness).
  139. ----
  140. .. _class_PhysicalBone3D_property_can_sleep:
  141. - :ref:`bool<class_bool>` **can_sleep**
  142. +-----------+----------------------+
  143. | *Default* | ``true`` |
  144. +-----------+----------------------+
  145. | *Setter* | set_can_sleep(value) |
  146. +-----------+----------------------+
  147. | *Getter* | is_able_to_sleep() |
  148. +-----------+----------------------+
  149. If ``true``, the body is deactivated when there is no movement, so it will not take part in the simulation until it is awakened by an external force.
  150. ----
  151. .. _class_PhysicalBone3D_property_custom_integrator:
  152. - :ref:`bool<class_bool>` **custom_integrator**
  153. +-----------+----------------------------------+
  154. | *Default* | ``false`` |
  155. +-----------+----------------------------------+
  156. | *Setter* | set_use_custom_integrator(value) |
  157. +-----------+----------------------------------+
  158. | *Getter* | is_using_custom_integrator() |
  159. +-----------+----------------------------------+
  160. If ``true``, internal force integration will be disabled (like gravity or air friction) for this body. Other than collision response, the body will only move as determined by the :ref:`_integrate_forces<class_PhysicalBone3D_method__integrate_forces>` function, if defined.
  161. ----
  162. .. _class_PhysicalBone3D_property_friction:
  163. - :ref:`float<class_float>` **friction**
  164. +-----------+---------------------+
  165. | *Default* | ``1.0`` |
  166. +-----------+---------------------+
  167. | *Setter* | set_friction(value) |
  168. +-----------+---------------------+
  169. | *Getter* | get_friction() |
  170. +-----------+---------------------+
  171. The body's friction, from ``0`` (frictionless) to ``1`` (max friction).
  172. ----
  173. .. _class_PhysicalBone3D_property_gravity_scale:
  174. - :ref:`float<class_float>` **gravity_scale**
  175. +-----------+--------------------------+
  176. | *Default* | ``1.0`` |
  177. +-----------+--------------------------+
  178. | *Setter* | set_gravity_scale(value) |
  179. +-----------+--------------------------+
  180. | *Getter* | get_gravity_scale() |
  181. +-----------+--------------------------+
  182. This is multiplied by the global 3D gravity setting found in **Project > Project Settings > Physics > 3d** to produce the body's gravity. For example, a value of 1 will be normal gravity, 2 will apply double gravity, and 0.5 will apply half gravity to this object.
  183. ----
  184. .. _class_PhysicalBone3D_property_joint_offset:
  185. - :ref:`Transform3D<class_Transform3D>` **joint_offset**
  186. +-----------+-----------------------------------------------------+
  187. | *Default* | ``Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)`` |
  188. +-----------+-----------------------------------------------------+
  189. | *Setter* | set_joint_offset(value) |
  190. +-----------+-----------------------------------------------------+
  191. | *Getter* | get_joint_offset() |
  192. +-----------+-----------------------------------------------------+
  193. Sets the joint's transform.
  194. ----
  195. .. _class_PhysicalBone3D_property_joint_rotation:
  196. - :ref:`Vector3<class_Vector3>` **joint_rotation**
  197. +-----------+---------------------------+
  198. | *Default* | ``Vector3(0, 0, 0)`` |
  199. +-----------+---------------------------+
  200. | *Setter* | set_joint_rotation(value) |
  201. +-----------+---------------------------+
  202. | *Getter* | get_joint_rotation() |
  203. +-----------+---------------------------+
  204. Sets the joint's rotation in radians.
  205. ----
  206. .. _class_PhysicalBone3D_property_joint_type:
  207. - :ref:`JointType<enum_PhysicalBone3D_JointType>` **joint_type**
  208. +-----------+-----------------------+
  209. | *Default* | ``0`` |
  210. +-----------+-----------------------+
  211. | *Setter* | set_joint_type(value) |
  212. +-----------+-----------------------+
  213. | *Getter* | get_joint_type() |
  214. +-----------+-----------------------+
  215. Sets the joint type. See :ref:`JointType<enum_PhysicalBone3D_JointType>` for possible values.
  216. ----
  217. .. _class_PhysicalBone3D_property_linear_damp:
  218. - :ref:`float<class_float>` **linear_damp**
  219. +-----------+------------------------+
  220. | *Default* | ``0.0`` |
  221. +-----------+------------------------+
  222. | *Setter* | set_linear_damp(value) |
  223. +-----------+------------------------+
  224. | *Getter* | get_linear_damp() |
  225. +-----------+------------------------+
  226. Damps the body's movement. By default, the body will use the **Default Linear Damp** in **Project > Project Settings > Physics > 3d** or any value override set by an :ref:`Area3D<class_Area3D>` the body is in. Depending on :ref:`linear_damp_mode<class_PhysicalBone3D_property_linear_damp_mode>`, you can set :ref:`linear_damp<class_PhysicalBone3D_property_linear_damp>` to be added to or to replace the body's damping value.
  227. See :ref:`ProjectSettings.physics/3d/default_linear_damp<class_ProjectSettings_property_physics/3d/default_linear_damp>` for more details about damping.
  228. ----
  229. .. _class_PhysicalBone3D_property_linear_damp_mode:
  230. - :ref:`DampMode<enum_PhysicalBone3D_DampMode>` **linear_damp_mode**
  231. +-----------+-----------------------------+
  232. | *Default* | ``0`` |
  233. +-----------+-----------------------------+
  234. | *Setter* | set_linear_damp_mode(value) |
  235. +-----------+-----------------------------+
  236. | *Getter* | get_linear_damp_mode() |
  237. +-----------+-----------------------------+
  238. Defines how :ref:`linear_damp<class_PhysicalBone3D_property_linear_damp>` is applied. See :ref:`DampMode<enum_PhysicalBone3D_DampMode>` for possible values.
  239. ----
  240. .. _class_PhysicalBone3D_property_linear_velocity:
  241. - :ref:`Vector3<class_Vector3>` **linear_velocity**
  242. +-----------+----------------------------+
  243. | *Default* | ``Vector3(0, 0, 0)`` |
  244. +-----------+----------------------------+
  245. | *Setter* | set_linear_velocity(value) |
  246. +-----------+----------------------------+
  247. | *Getter* | get_linear_velocity() |
  248. +-----------+----------------------------+
  249. The body's linear velocity in units per second. Can be used sporadically, but **don't set this every frame**, because physics may run in another thread and runs at a different granularity. Use :ref:`_integrate_forces<class_PhysicalBone3D_method__integrate_forces>` as your process loop for precise control of the body state.
  250. ----
  251. .. _class_PhysicalBone3D_property_mass:
  252. - :ref:`float<class_float>` **mass**
  253. +-----------+-----------------+
  254. | *Default* | ``1.0`` |
  255. +-----------+-----------------+
  256. | *Setter* | set_mass(value) |
  257. +-----------+-----------------+
  258. | *Getter* | get_mass() |
  259. +-----------+-----------------+
  260. The body's mass.
  261. Method Descriptions
  262. -------------------
  263. .. _class_PhysicalBone3D_method__integrate_forces:
  264. - void **_integrate_forces** **(** :ref:`PhysicsDirectBodyState3D<class_PhysicsDirectBodyState3D>` state **)** |virtual|
  265. Called during physics processing, allowing you to read and safely modify the simulation state for the object. By default, it works in addition to the usual physics behavior, but the :ref:`custom_integrator<class_PhysicalBone3D_property_custom_integrator>` property allows you to disable the default behavior and do fully custom force integration for a body.
  266. ----
  267. .. _class_PhysicalBone3D_method_apply_central_impulse:
  268. - void **apply_central_impulse** **(** :ref:`Vector3<class_Vector3>` impulse **)**
  269. ----
  270. .. _class_PhysicalBone3D_method_apply_impulse:
  271. - void **apply_impulse** **(** :ref:`Vector3<class_Vector3>` impulse, :ref:`Vector3<class_Vector3>` position=Vector3(0, 0, 0) **)**
  272. ----
  273. .. _class_PhysicalBone3D_method_get_bone_id:
  274. - :ref:`int<class_int>` **get_bone_id** **(** **)** |const|
  275. ----
  276. .. _class_PhysicalBone3D_method_get_simulate_physics:
  277. - :ref:`bool<class_bool>` **get_simulate_physics** **(** **)**
  278. ----
  279. .. _class_PhysicalBone3D_method_is_simulating_physics:
  280. - :ref:`bool<class_bool>` **is_simulating_physics** **(** **)**
  281. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  282. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  283. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  284. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  285. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  286. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`