class_particles.rst 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
  3. .. _class_Particles:
  4. Particles
  5. =========
  6. **Inherits:** :ref:`GeometryInstance<class_geometryinstance>` **<** :ref:`VisualInstance<class_visualinstance>` **<** :ref:`Spatial<class_spatial>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  7. **Category:** Core
  8. Brief Description
  9. -----------------
  10. Particle system 3D Node
  11. Member Functions
  12. ----------------
  13. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  14. | :ref:`int<class_int>` | :ref:`get_amount<class_Particles_get_amount>` **(** **)** const |
  15. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  16. | :ref:`Color<class_color>` | :ref:`get_color_phase_color<class_Particles_get_color_phase_color>` **(** :ref:`int<class_int>` phase **)** const |
  17. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | :ref:`float<class_float>` | :ref:`get_color_phase_pos<class_Particles_get_color_phase_pos>` **(** :ref:`int<class_int>` phase **)** const |
  19. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`int<class_int>` | :ref:`get_color_phases<class_Particles_get_color_phases>` **(** **)** const |
  21. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`Vector3<class_vector3>` | :ref:`get_emission_base_velocity<class_Particles_get_emission_base_velocity>` **(** **)** const |
  23. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`Vector3<class_vector3>` | :ref:`get_emission_half_extents<class_Particles_get_emission_half_extents>` **(** **)** const |
  25. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`Vector3Array<class_vector3array>` | :ref:`get_emission_points<class_Particles_get_emission_points>` **(** **)** const |
  27. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`float<class_float>` | :ref:`get_emit_timeout<class_Particles_get_emit_timeout>` **(** **)** const |
  29. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`Vector3<class_vector3>` | :ref:`get_gravity_normal<class_Particles_get_gravity_normal>` **(** **)** const |
  31. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`Material<class_material>` | :ref:`get_material<class_Particles_get_material>` **(** **)** const |
  33. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`float<class_float>` | :ref:`get_randomness<class_Particles_get_randomness>` **(** :ref:`int<class_int>` variable **)** const |
  35. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`float<class_float>` | :ref:`get_variable<class_Particles_get_variable>` **(** :ref:`int<class_int>` variable **)** const |
  37. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`AABB<class_aabb>` | :ref:`get_visibility_aabb<class_Particles_get_visibility_aabb>` **(** **)** const |
  39. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`bool<class_bool>` | :ref:`has_height_from_velocity<class_Particles_has_height_from_velocity>` **(** **)** const |
  41. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`bool<class_bool>` | :ref:`is_emitting<class_Particles_is_emitting>` **(** **)** const |
  43. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`bool<class_bool>` | :ref:`is_using_local_coordinates<class_Particles_is_using_local_coordinates>` **(** **)** const |
  45. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | void | :ref:`set_amount<class_Particles_set_amount>` **(** :ref:`int<class_int>` amount **)** |
  47. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | void | :ref:`set_color_phase_color<class_Particles_set_color_phase_color>` **(** :ref:`int<class_int>` phase, :ref:`Color<class_color>` color **)** |
  49. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | void | :ref:`set_color_phase_pos<class_Particles_set_color_phase_pos>` **(** :ref:`int<class_int>` phase, :ref:`float<class_float>` pos **)** |
  51. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | void | :ref:`set_color_phases<class_Particles_set_color_phases>` **(** :ref:`int<class_int>` count **)** |
  53. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | void | :ref:`set_emission_base_velocity<class_Particles_set_emission_base_velocity>` **(** :ref:`Vector3<class_vector3>` base_velocity **)** |
  55. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | void | :ref:`set_emission_half_extents<class_Particles_set_emission_half_extents>` **(** :ref:`Vector3<class_vector3>` half_extents **)** |
  57. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | void | :ref:`set_emission_points<class_Particles_set_emission_points>` **(** :ref:`Vector3Array<class_vector3array>` points **)** |
  59. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | void | :ref:`set_emit_timeout<class_Particles_set_emit_timeout>` **(** :ref:`float<class_float>` timeout **)** |
  61. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | void | :ref:`set_emitting<class_Particles_set_emitting>` **(** :ref:`bool<class_bool>` enabled **)** |
  63. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | void | :ref:`set_gravity_normal<class_Particles_set_gravity_normal>` **(** :ref:`Vector3<class_vector3>` normal **)** |
  65. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | void | :ref:`set_height_from_velocity<class_Particles_set_height_from_velocity>` **(** :ref:`bool<class_bool>` enable **)** |
  67. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | void | :ref:`set_material<class_Particles_set_material>` **(** :ref:`Material<class_material>` material **)** |
  69. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | void | :ref:`set_randomness<class_Particles_set_randomness>` **(** :ref:`int<class_int>` variable, :ref:`float<class_float>` randomness **)** |
  71. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | void | :ref:`set_use_local_coordinates<class_Particles_set_use_local_coordinates>` **(** :ref:`bool<class_bool>` enable **)** |
  73. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | void | :ref:`set_variable<class_Particles_set_variable>` **(** :ref:`int<class_int>` variable, :ref:`float<class_float>` value **)** |
  75. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | void | :ref:`set_visibility_aabb<class_Particles_set_visibility_aabb>` **(** :ref:`AABB<class_aabb>` aabb **)** |
  77. +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
  78. Numeric Constants
  79. -----------------
  80. - **VAR_LIFETIME** = **0**
  81. - **VAR_SPREAD** = **1**
  82. - **VAR_GRAVITY** = **2**
  83. - **VAR_LINEAR_VELOCITY** = **3**
  84. - **VAR_ANGULAR_VELOCITY** = **4**
  85. - **VAR_LINEAR_ACCELERATION** = **5**
  86. - **VAR_DRAG** = **6**
  87. - **VAR_TANGENTIAL_ACCELERATION** = **7**
  88. - **VAR_INITIAL_SIZE** = **9**
  89. - **VAR_FINAL_SIZE** = **10**
  90. - **VAR_INITIAL_ANGLE** = **11**
  91. - **VAR_HEIGHT** = **12**
  92. - **VAR_HEIGHT_SPEED_SCALE** = **13**
  93. - **VAR_MAX** = **14**
  94. Description
  95. -----------
  96. Particles is a particle system 3D :ref:`Node<class_node>` that is used to simulate several types of particle effects, such as explosions, rain, snow, fireflies, or other magical-like shinny sparkles. Particles are drawn using impostors, and given their dynamic behavior, the user must provide a visibility AABB (although helpers to create one automatically exist).
  97. Member Function Description
  98. ---------------------------
  99. .. _class_Particles_get_amount:
  100. - :ref:`int<class_int>` **get_amount** **(** **)** const
  101. Return the total amount of particles in the system.
  102. .. _class_Particles_get_color_phase_color:
  103. - :ref:`Color<class_color>` **get_color_phase_color** **(** :ref:`int<class_int>` phase **)** const
  104. Return the color of a color phase.
  105. .. _class_Particles_get_color_phase_pos:
  106. - :ref:`float<class_float>` **get_color_phase_pos** **(** :ref:`int<class_int>` phase **)** const
  107. Return the position of a color phase (0 to 1).
  108. .. _class_Particles_get_color_phases:
  109. - :ref:`int<class_int>` **get_color_phases** **(** **)** const
  110. .. _class_Particles_get_emission_base_velocity:
  111. - :ref:`Vector3<class_vector3>` **get_emission_base_velocity** **(** **)** const
  112. .. _class_Particles_get_emission_half_extents:
  113. - :ref:`Vector3<class_vector3>` **get_emission_half_extents** **(** **)** const
  114. Return the half extents for the emission box.
  115. .. _class_Particles_get_emission_points:
  116. - :ref:`Vector3Array<class_vector3array>` **get_emission_points** **(** **)** const
  117. .. _class_Particles_get_emit_timeout:
  118. - :ref:`float<class_float>` **get_emit_timeout** **(** **)** const
  119. .. _class_Particles_get_gravity_normal:
  120. - :ref:`Vector3<class_vector3>` **get_gravity_normal** **(** **)** const
  121. Return the normal vector towards where gravity is pulling (by default, negative Y).
  122. .. _class_Particles_get_material:
  123. - :ref:`Material<class_material>` **get_material** **(** **)** const
  124. Return the material used to draw particles.
  125. .. _class_Particles_get_randomness:
  126. - :ref:`float<class_float>` **get_randomness** **(** :ref:`int<class_int>` variable **)** const
  127. Return the randomness for a specific variable of the particle system. Randomness produces small changes from the default each time a particle is emitted.
  128. .. _class_Particles_get_variable:
  129. - :ref:`float<class_float>` **get_variable** **(** :ref:`int<class_int>` variable **)** const
  130. Return a specific variable for the particle system (see VAR\_\* enum).
  131. .. _class_Particles_get_visibility_aabb:
  132. - :ref:`AABB<class_aabb>` **get_visibility_aabb** **(** **)** const
  133. Return the current visibility AABB.
  134. .. _class_Particles_has_height_from_velocity:
  135. - :ref:`bool<class_bool>` **has_height_from_velocity** **(** **)** const
  136. .. _class_Particles_is_emitting:
  137. - :ref:`bool<class_bool>` **is_emitting** **(** **)** const
  138. Return the "emitting" property state (see :ref:`set_emitting<class_Particles_set_emitting>`).
  139. .. _class_Particles_is_using_local_coordinates:
  140. - :ref:`bool<class_bool>` **is_using_local_coordinates** **(** **)** const
  141. .. _class_Particles_set_amount:
  142. - void **set_amount** **(** :ref:`int<class_int>` amount **)**
  143. Set total amount of particles in the system.
  144. .. _class_Particles_set_color_phase_color:
  145. - void **set_color_phase_color** **(** :ref:`int<class_int>` phase, :ref:`Color<class_color>` color **)**
  146. Set the color of a color phase.
  147. .. _class_Particles_set_color_phase_pos:
  148. - void **set_color_phase_pos** **(** :ref:`int<class_int>` phase, :ref:`float<class_float>` pos **)**
  149. Set the position of a color phase (0 to 1).
  150. .. _class_Particles_set_color_phases:
  151. - void **set_color_phases** **(** :ref:`int<class_int>` count **)**
  152. .. _class_Particles_set_emission_base_velocity:
  153. - void **set_emission_base_velocity** **(** :ref:`Vector3<class_vector3>` base_velocity **)**
  154. .. _class_Particles_set_emission_half_extents:
  155. - void **set_emission_half_extents** **(** :ref:`Vector3<class_vector3>` half_extents **)**
  156. Set the half extents for the emission box.
  157. .. _class_Particles_set_emission_points:
  158. - void **set_emission_points** **(** :ref:`Vector3Array<class_vector3array>` points **)**
  159. .. _class_Particles_set_emit_timeout:
  160. - void **set_emit_timeout** **(** :ref:`float<class_float>` timeout **)**
  161. .. _class_Particles_set_emitting:
  162. - void **set_emitting** **(** :ref:`bool<class_bool>` enabled **)**
  163. Set the "emitting" property state. When emitting, the particle system generates new particles at constant rate.
  164. .. _class_Particles_set_gravity_normal:
  165. - void **set_gravity_normal** **(** :ref:`Vector3<class_vector3>` normal **)**
  166. Set the normal vector towards where gravity is pulling (by default, negative Y).
  167. .. _class_Particles_set_height_from_velocity:
  168. - void **set_height_from_velocity** **(** :ref:`bool<class_bool>` enable **)**
  169. .. _class_Particles_set_material:
  170. - void **set_material** **(** :ref:`Material<class_material>` material **)**
  171. Set the material used to draw particles.
  172. .. _class_Particles_set_randomness:
  173. - void **set_randomness** **(** :ref:`int<class_int>` variable, :ref:`float<class_float>` randomness **)**
  174. Set the randomness for a specific variable of the particle system. Randomness produces small changes from the default each time a particle is emitted.
  175. .. _class_Particles_set_use_local_coordinates:
  176. - void **set_use_local_coordinates** **(** :ref:`bool<class_bool>` enable **)**
  177. .. _class_Particles_set_variable:
  178. - void **set_variable** **(** :ref:`int<class_int>` variable, :ref:`float<class_float>` value **)**
  179. Set a specific variable for the particle system (see VAR\_\* enum).
  180. .. _class_Particles_set_visibility_aabb:
  181. - void **set_visibility_aabb** **(** :ref:`AABB<class_aabb>` aabb **)**
  182. Set the visibility AABB for the particle system, since the default one will not work properly most of the time.