class_softdynamicbody3d.rst 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  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 SoftDynamicBody3D.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_SoftDynamicBody3D:
  6. SoftDynamicBody3D
  7. =================
  8. **Inherits:** :ref:`MeshInstance3D<class_MeshInstance3D>` **<** :ref:`GeometryInstance3D<class_GeometryInstance3D>` **<** :ref:`VisualInstance3D<class_VisualInstance3D>` **<** :ref:`Node3D<class_Node3D>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. A soft mesh physics body.
  10. Description
  11. -----------
  12. A deformable physics body. Used to create elastic or deformable objects such as cloth, rubber, or other flexible materials.
  13. Tutorials
  14. ---------
  15. - :doc:`SoftBody <../tutorials/physics/soft_body>`
  16. Properties
  17. ----------
  18. +--------------------------------------------------------+------------------------------------------------------------------------------------------+------------------+
  19. | :ref:`int<class_int>` | :ref:`collision_layer<class_SoftDynamicBody3D_property_collision_layer>` | ``1`` |
  20. +--------------------------------------------------------+------------------------------------------------------------------------------------------+------------------+
  21. | :ref:`int<class_int>` | :ref:`collision_mask<class_SoftDynamicBody3D_property_collision_mask>` | ``1`` |
  22. +--------------------------------------------------------+------------------------------------------------------------------------------------------+------------------+
  23. | :ref:`float<class_float>` | :ref:`damping_coefficient<class_SoftDynamicBody3D_property_damping_coefficient>` | ``0.01`` |
  24. +--------------------------------------------------------+------------------------------------------------------------------------------------------+------------------+
  25. | :ref:`DisableMode<enum_SoftDynamicBody3D_DisableMode>` | :ref:`disable_mode<class_SoftDynamicBody3D_property_disable_mode>` | ``0`` |
  26. +--------------------------------------------------------+------------------------------------------------------------------------------------------+------------------+
  27. | :ref:`float<class_float>` | :ref:`drag_coefficient<class_SoftDynamicBody3D_property_drag_coefficient>` | ``0.0`` |
  28. +--------------------------------------------------------+------------------------------------------------------------------------------------------+------------------+
  29. | :ref:`float<class_float>` | :ref:`linear_stiffness<class_SoftDynamicBody3D_property_linear_stiffness>` | ``0.5`` |
  30. +--------------------------------------------------------+------------------------------------------------------------------------------------------+------------------+
  31. | :ref:`NodePath<class_NodePath>` | :ref:`parent_collision_ignore<class_SoftDynamicBody3D_property_parent_collision_ignore>` | ``NodePath("")`` |
  32. +--------------------------------------------------------+------------------------------------------------------------------------------------------+------------------+
  33. | :ref:`float<class_float>` | :ref:`pressure_coefficient<class_SoftDynamicBody3D_property_pressure_coefficient>` | ``0.0`` |
  34. +--------------------------------------------------------+------------------------------------------------------------------------------------------+------------------+
  35. | :ref:`bool<class_bool>` | :ref:`ray_pickable<class_SoftDynamicBody3D_property_ray_pickable>` | ``true`` |
  36. +--------------------------------------------------------+------------------------------------------------------------------------------------------+------------------+
  37. | :ref:`int<class_int>` | :ref:`simulation_precision<class_SoftDynamicBody3D_property_simulation_precision>` | ``5`` |
  38. +--------------------------------------------------------+------------------------------------------------------------------------------------------+------------------+
  39. | :ref:`float<class_float>` | :ref:`total_mass<class_SoftDynamicBody3D_property_total_mass>` | ``1.0`` |
  40. +--------------------------------------------------------+------------------------------------------------------------------------------------------+------------------+
  41. Methods
  42. -------
  43. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | void | :ref:`add_collision_exception_with<class_SoftDynamicBody3D_method_add_collision_exception_with>` **(** :ref:`Node<class_Node>` body **)** |
  45. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`Array<class_Array>` | :ref:`get_collision_exceptions<class_SoftDynamicBody3D_method_get_collision_exceptions>` **(** **)** |
  47. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`bool<class_bool>` | :ref:`get_collision_layer_value<class_SoftDynamicBody3D_method_get_collision_layer_value>` **(** :ref:`int<class_int>` layer_number **)** |const| |
  49. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`bool<class_bool>` | :ref:`get_collision_mask_value<class_SoftDynamicBody3D_method_get_collision_mask_value>` **(** :ref:`int<class_int>` layer_number **)** |const| |
  51. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`RID<class_RID>` | :ref:`get_physics_rid<class_SoftDynamicBody3D_method_get_physics_rid>` **(** **)** |const| |
  53. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | :ref:`Vector3<class_Vector3>` | :ref:`get_point_transform<class_SoftDynamicBody3D_method_get_point_transform>` **(** :ref:`int<class_int>` point_index **)** |
  55. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | :ref:`bool<class_bool>` | :ref:`is_point_pinned<class_SoftDynamicBody3D_method_is_point_pinned>` **(** :ref:`int<class_int>` point_index **)** |const| |
  57. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | void | :ref:`remove_collision_exception_with<class_SoftDynamicBody3D_method_remove_collision_exception_with>` **(** :ref:`Node<class_Node>` body **)** |
  59. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | void | :ref:`set_collision_layer_value<class_SoftDynamicBody3D_method_set_collision_layer_value>` **(** :ref:`int<class_int>` layer_number, :ref:`bool<class_bool>` value **)** |
  61. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | void | :ref:`set_collision_mask_value<class_SoftDynamicBody3D_method_set_collision_mask_value>` **(** :ref:`int<class_int>` layer_number, :ref:`bool<class_bool>` value **)** |
  63. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | void | :ref:`set_point_pinned<class_SoftDynamicBody3D_method_set_point_pinned>` **(** :ref:`int<class_int>` point_index, :ref:`bool<class_bool>` pinned, :ref:`NodePath<class_NodePath>` attachment_path=NodePath("") **)** |
  65. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. Enumerations
  67. ------------
  68. .. _enum_SoftDynamicBody3D_DisableMode:
  69. .. _class_SoftDynamicBody3D_constant_DISABLE_MODE_REMOVE:
  70. .. _class_SoftDynamicBody3D_constant_DISABLE_MODE_KEEP_ACTIVE:
  71. enum **DisableMode**:
  72. - **DISABLE_MODE_REMOVE** = **0** --- When :ref:`Node.process_mode<class_Node_property_process_mode>` is set to :ref:`Node.PROCESS_MODE_DISABLED<class_Node_constant_PROCESS_MODE_DISABLED>`, remove from the physics simulation to stop all physics interactions with this ``SoftDynamicBody3D``.
  73. Automatically re-added to the physics simulation when the :ref:`Node<class_Node>` is processed again.
  74. - **DISABLE_MODE_KEEP_ACTIVE** = **1** --- When :ref:`Node.process_mode<class_Node_property_process_mode>` is set to :ref:`Node.PROCESS_MODE_DISABLED<class_Node_constant_PROCESS_MODE_DISABLED>`, do not affect the physics simulation.
  75. Property Descriptions
  76. ---------------------
  77. .. _class_SoftDynamicBody3D_property_collision_layer:
  78. - :ref:`int<class_int>` **collision_layer**
  79. +-----------+----------------------------+
  80. | *Default* | ``1`` |
  81. +-----------+----------------------------+
  82. | *Setter* | set_collision_layer(value) |
  83. +-----------+----------------------------+
  84. | *Getter* | get_collision_layer() |
  85. +-----------+----------------------------+
  86. The physics layers this SoftDynamicBody3D **is in**. Collision objects can exist in one or more of 32 different layers. See also :ref:`collision_mask<class_SoftDynamicBody3D_property_collision_mask>`.
  87. **Note:** Object A can detect a contact with object B only if object B is in any of the layers that object A scans. See `Collision layers and masks <../tutorials/physics/physics_introduction.html#collision-layers-and-masks>`__ in the documentation for more information.
  88. ----
  89. .. _class_SoftDynamicBody3D_property_collision_mask:
  90. - :ref:`int<class_int>` **collision_mask**
  91. +-----------+---------------------------+
  92. | *Default* | ``1`` |
  93. +-----------+---------------------------+
  94. | *Setter* | set_collision_mask(value) |
  95. +-----------+---------------------------+
  96. | *Getter* | get_collision_mask() |
  97. +-----------+---------------------------+
  98. The physics layers this SoftDynamicBody3D **scans**. Collision objects can scan one or more of 32 different layers. See also :ref:`collision_layer<class_SoftDynamicBody3D_property_collision_layer>`.
  99. **Note:** Object A can detect a contact with object B only if object B is in any of the layers that object A scans. See `Collision layers and masks <../tutorials/physics/physics_introduction.html#collision-layers-and-masks>`__ in the documentation for more information.
  100. ----
  101. .. _class_SoftDynamicBody3D_property_damping_coefficient:
  102. - :ref:`float<class_float>` **damping_coefficient**
  103. +-----------+--------------------------------+
  104. | *Default* | ``0.01`` |
  105. +-----------+--------------------------------+
  106. | *Setter* | set_damping_coefficient(value) |
  107. +-----------+--------------------------------+
  108. | *Getter* | get_damping_coefficient() |
  109. +-----------+--------------------------------+
  110. ----
  111. .. _class_SoftDynamicBody3D_property_disable_mode:
  112. - :ref:`DisableMode<enum_SoftDynamicBody3D_DisableMode>` **disable_mode**
  113. +-----------+-------------------------+
  114. | *Default* | ``0`` |
  115. +-----------+-------------------------+
  116. | *Setter* | set_disable_mode(value) |
  117. +-----------+-------------------------+
  118. | *Getter* | get_disable_mode() |
  119. +-----------+-------------------------+
  120. Defines the behavior in physics when :ref:`Node.process_mode<class_Node_property_process_mode>` is set to :ref:`Node.PROCESS_MODE_DISABLED<class_Node_constant_PROCESS_MODE_DISABLED>`. See :ref:`DisableMode<enum_SoftDynamicBody3D_DisableMode>` for more details about the different modes.
  121. ----
  122. .. _class_SoftDynamicBody3D_property_drag_coefficient:
  123. - :ref:`float<class_float>` **drag_coefficient**
  124. +-----------+-----------------------------+
  125. | *Default* | ``0.0`` |
  126. +-----------+-----------------------------+
  127. | *Setter* | set_drag_coefficient(value) |
  128. +-----------+-----------------------------+
  129. | *Getter* | get_drag_coefficient() |
  130. +-----------+-----------------------------+
  131. ----
  132. .. _class_SoftDynamicBody3D_property_linear_stiffness:
  133. - :ref:`float<class_float>` **linear_stiffness**
  134. +-----------+-----------------------------+
  135. | *Default* | ``0.5`` |
  136. +-----------+-----------------------------+
  137. | *Setter* | set_linear_stiffness(value) |
  138. +-----------+-----------------------------+
  139. | *Getter* | get_linear_stiffness() |
  140. +-----------+-----------------------------+
  141. ----
  142. .. _class_SoftDynamicBody3D_property_parent_collision_ignore:
  143. - :ref:`NodePath<class_NodePath>` **parent_collision_ignore**
  144. +-----------+------------------------------------+
  145. | *Default* | ``NodePath("")`` |
  146. +-----------+------------------------------------+
  147. | *Setter* | set_parent_collision_ignore(value) |
  148. +-----------+------------------------------------+
  149. | *Getter* | get_parent_collision_ignore() |
  150. +-----------+------------------------------------+
  151. :ref:`NodePath<class_NodePath>` to a :ref:`CollisionObject3D<class_CollisionObject3D>` this SoftDynamicBody3D should avoid clipping.
  152. ----
  153. .. _class_SoftDynamicBody3D_property_pressure_coefficient:
  154. - :ref:`float<class_float>` **pressure_coefficient**
  155. +-----------+---------------------------------+
  156. | *Default* | ``0.0`` |
  157. +-----------+---------------------------------+
  158. | *Setter* | set_pressure_coefficient(value) |
  159. +-----------+---------------------------------+
  160. | *Getter* | get_pressure_coefficient() |
  161. +-----------+---------------------------------+
  162. ----
  163. .. _class_SoftDynamicBody3D_property_ray_pickable:
  164. - :ref:`bool<class_bool>` **ray_pickable**
  165. +-----------+-------------------------+
  166. | *Default* | ``true`` |
  167. +-----------+-------------------------+
  168. | *Setter* | set_ray_pickable(value) |
  169. +-----------+-------------------------+
  170. | *Getter* | is_ray_pickable() |
  171. +-----------+-------------------------+
  172. If ``true``, the ``SoftDynamicBody3D`` will respond to :ref:`RayCast3D<class_RayCast3D>`\ s.
  173. ----
  174. .. _class_SoftDynamicBody3D_property_simulation_precision:
  175. - :ref:`int<class_int>` **simulation_precision**
  176. +-----------+---------------------------------+
  177. | *Default* | ``5`` |
  178. +-----------+---------------------------------+
  179. | *Setter* | set_simulation_precision(value) |
  180. +-----------+---------------------------------+
  181. | *Getter* | get_simulation_precision() |
  182. +-----------+---------------------------------+
  183. Increasing this value will improve the resulting simulation, but can affect performance. Use with care.
  184. ----
  185. .. _class_SoftDynamicBody3D_property_total_mass:
  186. - :ref:`float<class_float>` **total_mass**
  187. +-----------+-----------------------+
  188. | *Default* | ``1.0`` |
  189. +-----------+-----------------------+
  190. | *Setter* | set_total_mass(value) |
  191. +-----------+-----------------------+
  192. | *Getter* | get_total_mass() |
  193. +-----------+-----------------------+
  194. The SoftDynamicBody3D's mass.
  195. Method Descriptions
  196. -------------------
  197. .. _class_SoftDynamicBody3D_method_add_collision_exception_with:
  198. - void **add_collision_exception_with** **(** :ref:`Node<class_Node>` body **)**
  199. Adds a body to the list of bodies that this body can't collide with.
  200. ----
  201. .. _class_SoftDynamicBody3D_method_get_collision_exceptions:
  202. - :ref:`Array<class_Array>` **get_collision_exceptions** **(** **)**
  203. Returns an array of nodes that were added as collision exceptions for this body.
  204. ----
  205. .. _class_SoftDynamicBody3D_method_get_collision_layer_value:
  206. - :ref:`bool<class_bool>` **get_collision_layer_value** **(** :ref:`int<class_int>` layer_number **)** |const|
  207. Returns whether or not the specified layer of the :ref:`collision_layer<class_SoftDynamicBody3D_property_collision_layer>` is enabled, given a ``layer_number`` between 1 and 32.
  208. ----
  209. .. _class_SoftDynamicBody3D_method_get_collision_mask_value:
  210. - :ref:`bool<class_bool>` **get_collision_mask_value** **(** :ref:`int<class_int>` layer_number **)** |const|
  211. Returns whether or not the specified layer of the :ref:`collision_mask<class_SoftDynamicBody3D_property_collision_mask>` is enabled, given a ``layer_number`` between 1 and 32.
  212. ----
  213. .. _class_SoftDynamicBody3D_method_get_physics_rid:
  214. - :ref:`RID<class_RID>` **get_physics_rid** **(** **)** |const|
  215. ----
  216. .. _class_SoftDynamicBody3D_method_get_point_transform:
  217. - :ref:`Vector3<class_Vector3>` **get_point_transform** **(** :ref:`int<class_int>` point_index **)**
  218. Returns local translation of a vertex in the surface array.
  219. ----
  220. .. _class_SoftDynamicBody3D_method_is_point_pinned:
  221. - :ref:`bool<class_bool>` **is_point_pinned** **(** :ref:`int<class_int>` point_index **)** |const|
  222. Returns ``true`` if vertex is set to pinned.
  223. ----
  224. .. _class_SoftDynamicBody3D_method_remove_collision_exception_with:
  225. - void **remove_collision_exception_with** **(** :ref:`Node<class_Node>` body **)**
  226. Removes a body from the list of bodies that this body can't collide with.
  227. ----
  228. .. _class_SoftDynamicBody3D_method_set_collision_layer_value:
  229. - void **set_collision_layer_value** **(** :ref:`int<class_int>` layer_number, :ref:`bool<class_bool>` value **)**
  230. Based on ``value``, enables or disables the specified layer in the :ref:`collision_layer<class_SoftDynamicBody3D_property_collision_layer>`, given a ``layer_number`` between 1 and 32.
  231. ----
  232. .. _class_SoftDynamicBody3D_method_set_collision_mask_value:
  233. - void **set_collision_mask_value** **(** :ref:`int<class_int>` layer_number, :ref:`bool<class_bool>` value **)**
  234. Based on ``value``, enables or disables the specified layer in the :ref:`collision_mask<class_SoftDynamicBody3D_property_collision_mask>`, given a ``layer_number`` between 1 and 32.
  235. ----
  236. .. _class_SoftDynamicBody3D_method_set_point_pinned:
  237. - void **set_point_pinned** **(** :ref:`int<class_int>` point_index, :ref:`bool<class_bool>` pinned, :ref:`NodePath<class_NodePath>` attachment_path=NodePath("") **)**
  238. Sets the pinned state of a surface vertex. When set to ``true``, the optional ``attachment_path`` can define a :ref:`Node3D<class_Node3D>` the pinned vertex will be attached to.
  239. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  240. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  241. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  242. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  243. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  244. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`