class_gpuparticlescollisionheightfield3d.rst 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  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/doc/classes/GPUParticlesCollisionHeightField3D.xml.
  6. .. _class_GPUParticlesCollisionHeightField3D:
  7. GPUParticlesCollisionHeightField3D
  8. ==================================
  9. **Inherits:** :ref:`GPUParticlesCollision3D<class_GPUParticlesCollision3D>` **<** :ref:`VisualInstance3D<class_VisualInstance3D>` **<** :ref:`Node3D<class_Node3D>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. A real-time heightmap-shaped 3D particle collision shape affecting :ref:`GPUParticles3D<class_GPUParticles3D>` nodes.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. A real-time heightmap-shaped 3D particle collision shape affecting :ref:`GPUParticles3D<class_GPUParticles3D>` nodes.
  15. Heightmap shapes allow for efficiently representing collisions for convex and concave objects with a single "floor" (such as terrain). This is less flexible than :ref:`GPUParticlesCollisionSDF3D<class_GPUParticlesCollisionSDF3D>`, but it doesn't require a baking step.
  16. \ **GPUParticlesCollisionHeightField3D** can also be regenerated in real-time when it is moved, when the camera moves, or even continuously. This makes **GPUParticlesCollisionHeightField3D** a good choice for weather effects such as rain and snow and games with highly dynamic geometry. However, this class is limited since heightmaps cannot represent overhangs (e.g. indoors or caves).
  17. \ **Note:** :ref:`ParticleProcessMaterial.collision_mode<class_ParticleProcessMaterial_property_collision_mode>` must be ``true`` on the :ref:`GPUParticles3D<class_GPUParticles3D>`'s process material for collision to work.
  18. \ **Note:** Particle collision only affects :ref:`GPUParticles3D<class_GPUParticles3D>`, not :ref:`CPUParticles3D<class_CPUParticles3D>`.
  19. .. rst-class:: classref-reftable-group
  20. Properties
  21. ----------
  22. .. table::
  23. :widths: auto
  24. +-----------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------------+
  25. | :ref:`bool<class_bool>` | :ref:`follow_camera_enabled<class_GPUParticlesCollisionHeightField3D_property_follow_camera_enabled>` | ``false`` |
  26. +-----------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------------+
  27. | :ref:`int<class_int>` | :ref:`heightfield_mask<class_GPUParticlesCollisionHeightField3D_property_heightfield_mask>` | ``1048575`` |
  28. +-----------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------------+
  29. | :ref:`Resolution<enum_GPUParticlesCollisionHeightField3D_Resolution>` | :ref:`resolution<class_GPUParticlesCollisionHeightField3D_property_resolution>` | ``2`` |
  30. +-----------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------------+
  31. | :ref:`Vector3<class_Vector3>` | :ref:`size<class_GPUParticlesCollisionHeightField3D_property_size>` | ``Vector3(2, 2, 2)`` |
  32. +-----------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------------+
  33. | :ref:`UpdateMode<enum_GPUParticlesCollisionHeightField3D_UpdateMode>` | :ref:`update_mode<class_GPUParticlesCollisionHeightField3D_property_update_mode>` | ``0`` |
  34. +-----------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+----------------------+
  35. .. rst-class:: classref-reftable-group
  36. Methods
  37. -------
  38. .. table::
  39. :widths: auto
  40. +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`bool<class_bool>` | :ref:`get_heightfield_mask_value<class_GPUParticlesCollisionHeightField3D_method_get_heightfield_mask_value>`\ (\ layer_number\: :ref:`int<class_int>`\ ) |const| |
  42. +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | |void| | :ref:`set_heightfield_mask_value<class_GPUParticlesCollisionHeightField3D_method_set_heightfield_mask_value>`\ (\ layer_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) |
  44. +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. .. rst-class:: classref-section-separator
  46. ----
  47. .. rst-class:: classref-descriptions-group
  48. Enumerations
  49. ------------
  50. .. _enum_GPUParticlesCollisionHeightField3D_Resolution:
  51. .. rst-class:: classref-enumeration
  52. enum **Resolution**: :ref:`🔗<enum_GPUParticlesCollisionHeightField3D_Resolution>`
  53. .. _class_GPUParticlesCollisionHeightField3D_constant_RESOLUTION_256:
  54. .. rst-class:: classref-enumeration-constant
  55. :ref:`Resolution<enum_GPUParticlesCollisionHeightField3D_Resolution>` **RESOLUTION_256** = ``0``
  56. Generate a 256×256 heightmap. Intended for small-scale scenes, or larger scenes with no distant particles.
  57. .. _class_GPUParticlesCollisionHeightField3D_constant_RESOLUTION_512:
  58. .. rst-class:: classref-enumeration-constant
  59. :ref:`Resolution<enum_GPUParticlesCollisionHeightField3D_Resolution>` **RESOLUTION_512** = ``1``
  60. Generate a 512×512 heightmap. Intended for medium-scale scenes, or larger scenes with no distant particles.
  61. .. _class_GPUParticlesCollisionHeightField3D_constant_RESOLUTION_1024:
  62. .. rst-class:: classref-enumeration-constant
  63. :ref:`Resolution<enum_GPUParticlesCollisionHeightField3D_Resolution>` **RESOLUTION_1024** = ``2``
  64. Generate a 1024×1024 heightmap. Intended for large scenes with distant particles.
  65. .. _class_GPUParticlesCollisionHeightField3D_constant_RESOLUTION_2048:
  66. .. rst-class:: classref-enumeration-constant
  67. :ref:`Resolution<enum_GPUParticlesCollisionHeightField3D_Resolution>` **RESOLUTION_2048** = ``3``
  68. Generate a 2048×2048 heightmap. Intended for very large scenes with distant particles.
  69. .. _class_GPUParticlesCollisionHeightField3D_constant_RESOLUTION_4096:
  70. .. rst-class:: classref-enumeration-constant
  71. :ref:`Resolution<enum_GPUParticlesCollisionHeightField3D_Resolution>` **RESOLUTION_4096** = ``4``
  72. Generate a 4096×4096 heightmap. Intended for huge scenes with distant particles.
  73. .. _class_GPUParticlesCollisionHeightField3D_constant_RESOLUTION_8192:
  74. .. rst-class:: classref-enumeration-constant
  75. :ref:`Resolution<enum_GPUParticlesCollisionHeightField3D_Resolution>` **RESOLUTION_8192** = ``5``
  76. Generate a 8192×8192 heightmap. Intended for gigantic scenes with distant particles.
  77. .. _class_GPUParticlesCollisionHeightField3D_constant_RESOLUTION_MAX:
  78. .. rst-class:: classref-enumeration-constant
  79. :ref:`Resolution<enum_GPUParticlesCollisionHeightField3D_Resolution>` **RESOLUTION_MAX** = ``6``
  80. Represents the size of the :ref:`Resolution<enum_GPUParticlesCollisionHeightField3D_Resolution>` enum.
  81. .. rst-class:: classref-item-separator
  82. ----
  83. .. _enum_GPUParticlesCollisionHeightField3D_UpdateMode:
  84. .. rst-class:: classref-enumeration
  85. enum **UpdateMode**: :ref:`🔗<enum_GPUParticlesCollisionHeightField3D_UpdateMode>`
  86. .. _class_GPUParticlesCollisionHeightField3D_constant_UPDATE_MODE_WHEN_MOVED:
  87. .. rst-class:: classref-enumeration-constant
  88. :ref:`UpdateMode<enum_GPUParticlesCollisionHeightField3D_UpdateMode>` **UPDATE_MODE_WHEN_MOVED** = ``0``
  89. Only update the heightmap when the **GPUParticlesCollisionHeightField3D** node is moved, or when the camera moves if :ref:`follow_camera_enabled<class_GPUParticlesCollisionHeightField3D_property_follow_camera_enabled>` is ``true``. An update can be forced by slightly moving the **GPUParticlesCollisionHeightField3D** in any direction, or by calling :ref:`RenderingServer.particles_collision_height_field_update()<class_RenderingServer_method_particles_collision_height_field_update>`.
  90. .. _class_GPUParticlesCollisionHeightField3D_constant_UPDATE_MODE_ALWAYS:
  91. .. rst-class:: classref-enumeration-constant
  92. :ref:`UpdateMode<enum_GPUParticlesCollisionHeightField3D_UpdateMode>` **UPDATE_MODE_ALWAYS** = ``1``
  93. Update the heightmap every frame. This has a significant performance cost. This update should only be used when geometry that particles can collide with changes significantly during gameplay.
  94. .. rst-class:: classref-section-separator
  95. ----
  96. .. rst-class:: classref-descriptions-group
  97. Property Descriptions
  98. ---------------------
  99. .. _class_GPUParticlesCollisionHeightField3D_property_follow_camera_enabled:
  100. .. rst-class:: classref-property
  101. :ref:`bool<class_bool>` **follow_camera_enabled** = ``false`` :ref:`🔗<class_GPUParticlesCollisionHeightField3D_property_follow_camera_enabled>`
  102. .. rst-class:: classref-property-setget
  103. - |void| **set_follow_camera_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
  104. - :ref:`bool<class_bool>` **is_follow_camera_enabled**\ (\ )
  105. If ``true``, the **GPUParticlesCollisionHeightField3D** will follow the current camera in global space. The **GPUParticlesCollisionHeightField3D** does not need to be a child of the :ref:`Camera3D<class_Camera3D>` node for this to work.
  106. Following the camera has a performance cost, as it will force the heightmap to update whenever the camera moves. Consider lowering :ref:`resolution<class_GPUParticlesCollisionHeightField3D_property_resolution>` to improve performance if :ref:`follow_camera_enabled<class_GPUParticlesCollisionHeightField3D_property_follow_camera_enabled>` is ``true``.
  107. .. rst-class:: classref-item-separator
  108. ----
  109. .. _class_GPUParticlesCollisionHeightField3D_property_heightfield_mask:
  110. .. rst-class:: classref-property
  111. :ref:`int<class_int>` **heightfield_mask** = ``1048575`` :ref:`🔗<class_GPUParticlesCollisionHeightField3D_property_heightfield_mask>`
  112. .. rst-class:: classref-property-setget
  113. - |void| **set_heightfield_mask**\ (\ value\: :ref:`int<class_int>`\ )
  114. - :ref:`int<class_int>` **get_heightfield_mask**\ (\ )
  115. The visual layers to account for when updating the heightmap. Only :ref:`MeshInstance3D<class_MeshInstance3D>`\ s whose :ref:`VisualInstance3D.layers<class_VisualInstance3D_property_layers>` match with this :ref:`heightfield_mask<class_GPUParticlesCollisionHeightField3D_property_heightfield_mask>` will be included in the heightmap collision update. By default, all 20 user-visible layers are taken into account for updating the heightmap collision.
  116. \ **Note:** Since the :ref:`heightfield_mask<class_GPUParticlesCollisionHeightField3D_property_heightfield_mask>` allows for 32 layers to be stored in total, there are an additional 12 layers that are only used internally by the engine and aren't exposed in the editor. Setting :ref:`heightfield_mask<class_GPUParticlesCollisionHeightField3D_property_heightfield_mask>` using a script allows you to toggle those reserved layers, which can be useful for editor plugins.
  117. To adjust :ref:`heightfield_mask<class_GPUParticlesCollisionHeightField3D_property_heightfield_mask>` more easily using a script, use :ref:`get_heightfield_mask_value()<class_GPUParticlesCollisionHeightField3D_method_get_heightfield_mask_value>` and :ref:`set_heightfield_mask_value()<class_GPUParticlesCollisionHeightField3D_method_set_heightfield_mask_value>`.
  118. .. rst-class:: classref-item-separator
  119. ----
  120. .. _class_GPUParticlesCollisionHeightField3D_property_resolution:
  121. .. rst-class:: classref-property
  122. :ref:`Resolution<enum_GPUParticlesCollisionHeightField3D_Resolution>` **resolution** = ``2`` :ref:`🔗<class_GPUParticlesCollisionHeightField3D_property_resolution>`
  123. .. rst-class:: classref-property-setget
  124. - |void| **set_resolution**\ (\ value\: :ref:`Resolution<enum_GPUParticlesCollisionHeightField3D_Resolution>`\ )
  125. - :ref:`Resolution<enum_GPUParticlesCollisionHeightField3D_Resolution>` **get_resolution**\ (\ )
  126. Higher resolutions can represent small details more accurately in large scenes, at the cost of lower performance. If :ref:`update_mode<class_GPUParticlesCollisionHeightField3D_property_update_mode>` is :ref:`UPDATE_MODE_ALWAYS<class_GPUParticlesCollisionHeightField3D_constant_UPDATE_MODE_ALWAYS>`, consider using the lowest resolution possible.
  127. .. rst-class:: classref-item-separator
  128. ----
  129. .. _class_GPUParticlesCollisionHeightField3D_property_size:
  130. .. rst-class:: classref-property
  131. :ref:`Vector3<class_Vector3>` **size** = ``Vector3(2, 2, 2)`` :ref:`🔗<class_GPUParticlesCollisionHeightField3D_property_size>`
  132. .. rst-class:: classref-property-setget
  133. - |void| **set_size**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
  134. - :ref:`Vector3<class_Vector3>` **get_size**\ (\ )
  135. The collision heightmap's size in 3D units. To improve heightmap quality, :ref:`size<class_GPUParticlesCollisionHeightField3D_property_size>` should be set as small as possible while covering the parts of the scene you need.
  136. .. rst-class:: classref-item-separator
  137. ----
  138. .. _class_GPUParticlesCollisionHeightField3D_property_update_mode:
  139. .. rst-class:: classref-property
  140. :ref:`UpdateMode<enum_GPUParticlesCollisionHeightField3D_UpdateMode>` **update_mode** = ``0`` :ref:`🔗<class_GPUParticlesCollisionHeightField3D_property_update_mode>`
  141. .. rst-class:: classref-property-setget
  142. - |void| **set_update_mode**\ (\ value\: :ref:`UpdateMode<enum_GPUParticlesCollisionHeightField3D_UpdateMode>`\ )
  143. - :ref:`UpdateMode<enum_GPUParticlesCollisionHeightField3D_UpdateMode>` **get_update_mode**\ (\ )
  144. The update policy to use for the generated heightmap.
  145. .. rst-class:: classref-section-separator
  146. ----
  147. .. rst-class:: classref-descriptions-group
  148. Method Descriptions
  149. -------------------
  150. .. _class_GPUParticlesCollisionHeightField3D_method_get_heightfield_mask_value:
  151. .. rst-class:: classref-method
  152. :ref:`bool<class_bool>` **get_heightfield_mask_value**\ (\ layer_number\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_GPUParticlesCollisionHeightField3D_method_get_heightfield_mask_value>`
  153. Returns ``true`` if the specified layer of the :ref:`heightfield_mask<class_GPUParticlesCollisionHeightField3D_property_heightfield_mask>` is enabled, given a ``layer_number`` between ``1`` and ``20``, inclusive.
  154. .. rst-class:: classref-item-separator
  155. ----
  156. .. _class_GPUParticlesCollisionHeightField3D_method_set_heightfield_mask_value:
  157. .. rst-class:: classref-method
  158. |void| **set_heightfield_mask_value**\ (\ layer_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_GPUParticlesCollisionHeightField3D_method_set_heightfield_mask_value>`
  159. Based on ``value``, enables or disables the specified layer in the :ref:`heightfield_mask<class_GPUParticlesCollisionHeightField3D_property_heightfield_mask>`, given a ``layer_number`` between ``1`` and ``20``, inclusive.
  160. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  161. .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
  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.)`