class_multimesh.rst 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  1. :github_url: hide
  2. .. meta::
  3. :keywords: batch
  4. .. DO NOT EDIT THIS FILE!!!
  5. .. Generated automatically from Godot engine sources.
  6. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  7. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/MultiMesh.xml.
  8. .. _class_MultiMesh:
  9. MultiMesh
  10. =========
  11. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  12. Provides high-performance drawing of a mesh multiple times using GPU instancing.
  13. .. rst-class:: classref-introduction-group
  14. Description
  15. -----------
  16. MultiMesh provides low-level mesh instancing. Drawing thousands of :ref:`MeshInstance3D<class_MeshInstance3D>` nodes can be slow, since each object is submitted to the GPU then drawn individually.
  17. MultiMesh is much faster as it can draw thousands of instances with a single draw call, resulting in less API overhead.
  18. As a drawback, if the instances are too far away from each other, performance may be reduced as every single instance will always render (they are spatially indexed as one, for the whole object).
  19. Since instances may have any behavior, the AABB used for visibility must be provided by the user.
  20. \ **Note:** A MultiMesh is a single object, therefore the same maximum lights per object restriction applies. This means, that once the maximum lights are consumed by one or more instances, the rest of the MultiMesh instances will **not** receive any lighting.
  21. \ **Note:** Blend Shapes will be ignored if used in a MultiMesh.
  22. .. rst-class:: classref-introduction-group
  23. Tutorials
  24. ---------
  25. - :doc:`Using MultiMeshInstance <../tutorials/3d/using_multi_mesh_instance>`
  26. - :doc:`Optimization using MultiMeshes <../tutorials/performance/using_multimesh>`
  27. - :doc:`Animating thousands of fish with MultiMeshInstance <../tutorials/performance/vertex_animation/animating_thousands_of_fish>`
  28. .. rst-class:: classref-reftable-group
  29. Properties
  30. ----------
  31. .. table::
  32. :widths: auto
  33. +--------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------+----------------------------+
  34. | :ref:`PackedFloat32Array<class_PackedFloat32Array>` | :ref:`buffer<class_MultiMesh_property_buffer>` | ``PackedFloat32Array()`` |
  35. +--------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------+----------------------------+
  36. | :ref:`PackedColorArray<class_PackedColorArray>` | :ref:`color_array<class_MultiMesh_property_color_array>` | |
  37. +--------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------+----------------------------+
  38. | :ref:`AABB<class_AABB>` | :ref:`custom_aabb<class_MultiMesh_property_custom_aabb>` | ``AABB(0, 0, 0, 0, 0, 0)`` |
  39. +--------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------+----------------------------+
  40. | :ref:`PackedColorArray<class_PackedColorArray>` | :ref:`custom_data_array<class_MultiMesh_property_custom_data_array>` | |
  41. +--------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------+----------------------------+
  42. | :ref:`int<class_int>` | :ref:`instance_count<class_MultiMesh_property_instance_count>` | ``0`` |
  43. +--------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------+----------------------------+
  44. | :ref:`Mesh<class_Mesh>` | :ref:`mesh<class_MultiMesh_property_mesh>` | |
  45. +--------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------+----------------------------+
  46. | :ref:`PhysicsInterpolationQuality<enum_MultiMesh_PhysicsInterpolationQuality>` | :ref:`physics_interpolation_quality<class_MultiMesh_property_physics_interpolation_quality>` | ``0`` |
  47. +--------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------+----------------------------+
  48. | :ref:`PackedVector2Array<class_PackedVector2Array>` | :ref:`transform_2d_array<class_MultiMesh_property_transform_2d_array>` | |
  49. +--------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------+----------------------------+
  50. | :ref:`PackedVector3Array<class_PackedVector3Array>` | :ref:`transform_array<class_MultiMesh_property_transform_array>` | |
  51. +--------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------+----------------------------+
  52. | :ref:`TransformFormat<enum_MultiMesh_TransformFormat>` | :ref:`transform_format<class_MultiMesh_property_transform_format>` | ``0`` |
  53. +--------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------+----------------------------+
  54. | :ref:`bool<class_bool>` | :ref:`use_colors<class_MultiMesh_property_use_colors>` | ``false`` |
  55. +--------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------+----------------------------+
  56. | :ref:`bool<class_bool>` | :ref:`use_custom_data<class_MultiMesh_property_use_custom_data>` | ``false`` |
  57. +--------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------+----------------------------+
  58. | :ref:`int<class_int>` | :ref:`visible_instance_count<class_MultiMesh_property_visible_instance_count>` | ``-1`` |
  59. +--------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------+----------------------------+
  60. .. rst-class:: classref-reftable-group
  61. Methods
  62. -------
  63. .. table::
  64. :widths: auto
  65. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | :ref:`AABB<class_AABB>` | :ref:`get_aabb<class_MultiMesh_method_get_aabb>`\ (\ ) |const| |
  67. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | :ref:`Color<class_Color>` | :ref:`get_instance_color<class_MultiMesh_method_get_instance_color>`\ (\ instance\: :ref:`int<class_int>`\ ) |const| |
  69. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | :ref:`Color<class_Color>` | :ref:`get_instance_custom_data<class_MultiMesh_method_get_instance_custom_data>`\ (\ instance\: :ref:`int<class_int>`\ ) |const| |
  71. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | :ref:`Transform3D<class_Transform3D>` | :ref:`get_instance_transform<class_MultiMesh_method_get_instance_transform>`\ (\ instance\: :ref:`int<class_int>`\ ) |const| |
  73. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | :ref:`Transform2D<class_Transform2D>` | :ref:`get_instance_transform_2d<class_MultiMesh_method_get_instance_transform_2d>`\ (\ instance\: :ref:`int<class_int>`\ ) |const| |
  75. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | |void| | :ref:`reset_instance_physics_interpolation<class_MultiMesh_method_reset_instance_physics_interpolation>`\ (\ instance\: :ref:`int<class_int>`\ ) |
  77. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | |void| | :ref:`reset_instances_physics_interpolation<class_MultiMesh_method_reset_instances_physics_interpolation>`\ (\ ) |
  79. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | |void| | :ref:`set_buffer_interpolated<class_MultiMesh_method_set_buffer_interpolated>`\ (\ buffer_curr\: :ref:`PackedFloat32Array<class_PackedFloat32Array>`, buffer_prev\: :ref:`PackedFloat32Array<class_PackedFloat32Array>`\ ) |
  81. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | |void| | :ref:`set_instance_color<class_MultiMesh_method_set_instance_color>`\ (\ instance\: :ref:`int<class_int>`, color\: :ref:`Color<class_Color>`\ ) |
  83. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | |void| | :ref:`set_instance_custom_data<class_MultiMesh_method_set_instance_custom_data>`\ (\ instance\: :ref:`int<class_int>`, custom_data\: :ref:`Color<class_Color>`\ ) |
  85. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | |void| | :ref:`set_instance_transform<class_MultiMesh_method_set_instance_transform>`\ (\ instance\: :ref:`int<class_int>`, transform\: :ref:`Transform3D<class_Transform3D>`\ ) |
  87. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. | |void| | :ref:`set_instance_transform_2d<class_MultiMesh_method_set_instance_transform_2d>`\ (\ instance\: :ref:`int<class_int>`, transform\: :ref:`Transform2D<class_Transform2D>`\ ) |
  89. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  90. .. rst-class:: classref-section-separator
  91. ----
  92. .. rst-class:: classref-descriptions-group
  93. Enumerations
  94. ------------
  95. .. _enum_MultiMesh_TransformFormat:
  96. .. rst-class:: classref-enumeration
  97. enum **TransformFormat**: :ref:`🔗<enum_MultiMesh_TransformFormat>`
  98. .. _class_MultiMesh_constant_TRANSFORM_2D:
  99. .. rst-class:: classref-enumeration-constant
  100. :ref:`TransformFormat<enum_MultiMesh_TransformFormat>` **TRANSFORM_2D** = ``0``
  101. Use this when using 2D transforms.
  102. .. _class_MultiMesh_constant_TRANSFORM_3D:
  103. .. rst-class:: classref-enumeration-constant
  104. :ref:`TransformFormat<enum_MultiMesh_TransformFormat>` **TRANSFORM_3D** = ``1``
  105. Use this when using 3D transforms.
  106. .. rst-class:: classref-item-separator
  107. ----
  108. .. _enum_MultiMesh_PhysicsInterpolationQuality:
  109. .. rst-class:: classref-enumeration
  110. enum **PhysicsInterpolationQuality**: :ref:`🔗<enum_MultiMesh_PhysicsInterpolationQuality>`
  111. .. _class_MultiMesh_constant_INTERP_QUALITY_FAST:
  112. .. rst-class:: classref-enumeration-constant
  113. :ref:`PhysicsInterpolationQuality<enum_MultiMesh_PhysicsInterpolationQuality>` **INTERP_QUALITY_FAST** = ``0``
  114. Always interpolate using Basis lerping, which can produce warping artifacts in some situations.
  115. .. _class_MultiMesh_constant_INTERP_QUALITY_HIGH:
  116. .. rst-class:: classref-enumeration-constant
  117. :ref:`PhysicsInterpolationQuality<enum_MultiMesh_PhysicsInterpolationQuality>` **INTERP_QUALITY_HIGH** = ``1``
  118. Attempt to interpolate using Basis slerping (spherical linear interpolation) where possible, otherwise fall back to lerping.
  119. .. rst-class:: classref-section-separator
  120. ----
  121. .. rst-class:: classref-descriptions-group
  122. Property Descriptions
  123. ---------------------
  124. .. _class_MultiMesh_property_buffer:
  125. .. rst-class:: classref-property
  126. :ref:`PackedFloat32Array<class_PackedFloat32Array>` **buffer** = ``PackedFloat32Array()`` :ref:`🔗<class_MultiMesh_property_buffer>`
  127. .. rst-class:: classref-property-setget
  128. - |void| **set_buffer**\ (\ value\: :ref:`PackedFloat32Array<class_PackedFloat32Array>`\ )
  129. - :ref:`PackedFloat32Array<class_PackedFloat32Array>` **get_buffer**\ (\ )
  130. .. container:: contribute
  131. There is currently no description for this property. Please help us by `contributing one <https://contributing.godotengine.org/en/latest/documentation/class_reference.html>`__!
  132. **Note:** The returned array is *copied* and any changes to it will not update the original property value. See :ref:`PackedFloat32Array<class_PackedFloat32Array>` for more details.
  133. .. rst-class:: classref-item-separator
  134. ----
  135. .. _class_MultiMesh_property_color_array:
  136. .. rst-class:: classref-property
  137. :ref:`PackedColorArray<class_PackedColorArray>` **color_array** :ref:`🔗<class_MultiMesh_property_color_array>`
  138. **Deprecated:** Accessing this property is very slow. Use :ref:`set_instance_color()<class_MultiMesh_method_set_instance_color>` and :ref:`get_instance_color()<class_MultiMesh_method_get_instance_color>` instead.
  139. Array containing each :ref:`Color<class_Color>` used by all instances of this mesh.
  140. **Note:** The returned array is *copied* and any changes to it will not update the original property value. See :ref:`PackedColorArray<class_PackedColorArray>` for more details.
  141. .. rst-class:: classref-item-separator
  142. ----
  143. .. _class_MultiMesh_property_custom_aabb:
  144. .. rst-class:: classref-property
  145. :ref:`AABB<class_AABB>` **custom_aabb** = ``AABB(0, 0, 0, 0, 0, 0)`` :ref:`🔗<class_MultiMesh_property_custom_aabb>`
  146. .. rst-class:: classref-property-setget
  147. - |void| **set_custom_aabb**\ (\ value\: :ref:`AABB<class_AABB>`\ )
  148. - :ref:`AABB<class_AABB>` **get_custom_aabb**\ (\ )
  149. Custom AABB for this MultiMesh resource. Setting this manually prevents costly runtime AABB recalculations.
  150. .. rst-class:: classref-item-separator
  151. ----
  152. .. _class_MultiMesh_property_custom_data_array:
  153. .. rst-class:: classref-property
  154. :ref:`PackedColorArray<class_PackedColorArray>` **custom_data_array** :ref:`🔗<class_MultiMesh_property_custom_data_array>`
  155. **Deprecated:** Accessing this property is very slow. Use :ref:`set_instance_custom_data()<class_MultiMesh_method_set_instance_custom_data>` and :ref:`get_instance_custom_data()<class_MultiMesh_method_get_instance_custom_data>` instead.
  156. Array containing each custom data value used by all instances of this mesh, as a :ref:`PackedColorArray<class_PackedColorArray>`.
  157. **Note:** The returned array is *copied* and any changes to it will not update the original property value. See :ref:`PackedColorArray<class_PackedColorArray>` for more details.
  158. .. rst-class:: classref-item-separator
  159. ----
  160. .. _class_MultiMesh_property_instance_count:
  161. .. rst-class:: classref-property
  162. :ref:`int<class_int>` **instance_count** = ``0`` :ref:`🔗<class_MultiMesh_property_instance_count>`
  163. .. rst-class:: classref-property-setget
  164. - |void| **set_instance_count**\ (\ value\: :ref:`int<class_int>`\ )
  165. - :ref:`int<class_int>` **get_instance_count**\ (\ )
  166. Number of instances that will get drawn. This clears and (re)sizes the buffers. Setting data format or flags afterwards will have no effect.
  167. By default, all instances are drawn but you can limit this with :ref:`visible_instance_count<class_MultiMesh_property_visible_instance_count>`.
  168. .. rst-class:: classref-item-separator
  169. ----
  170. .. _class_MultiMesh_property_mesh:
  171. .. rst-class:: classref-property
  172. :ref:`Mesh<class_Mesh>` **mesh** :ref:`🔗<class_MultiMesh_property_mesh>`
  173. .. rst-class:: classref-property-setget
  174. - |void| **set_mesh**\ (\ value\: :ref:`Mesh<class_Mesh>`\ )
  175. - :ref:`Mesh<class_Mesh>` **get_mesh**\ (\ )
  176. :ref:`Mesh<class_Mesh>` resource to be instanced.
  177. The looks of the individual instances can be modified using :ref:`set_instance_color()<class_MultiMesh_method_set_instance_color>` and :ref:`set_instance_custom_data()<class_MultiMesh_method_set_instance_custom_data>`.
  178. .. rst-class:: classref-item-separator
  179. ----
  180. .. _class_MultiMesh_property_physics_interpolation_quality:
  181. .. rst-class:: classref-property
  182. :ref:`PhysicsInterpolationQuality<enum_MultiMesh_PhysicsInterpolationQuality>` **physics_interpolation_quality** = ``0`` :ref:`🔗<class_MultiMesh_property_physics_interpolation_quality>`
  183. .. rst-class:: classref-property-setget
  184. - |void| **set_physics_interpolation_quality**\ (\ value\: :ref:`PhysicsInterpolationQuality<enum_MultiMesh_PhysicsInterpolationQuality>`\ )
  185. - :ref:`PhysicsInterpolationQuality<enum_MultiMesh_PhysicsInterpolationQuality>` **get_physics_interpolation_quality**\ (\ )
  186. Choose whether to use an interpolation method that favors speed or quality.
  187. When using low physics tick rates (typically below 20) or high rates of object rotation, you may get better results from the high quality setting.
  188. \ **Note:** Fast quality does not equate to low quality. Except in the special cases mentioned above, the quality should be comparable to high quality.
  189. .. rst-class:: classref-item-separator
  190. ----
  191. .. _class_MultiMesh_property_transform_2d_array:
  192. .. rst-class:: classref-property
  193. :ref:`PackedVector2Array<class_PackedVector2Array>` **transform_2d_array** :ref:`🔗<class_MultiMesh_property_transform_2d_array>`
  194. **Deprecated:** Accessing this property is very slow. Use :ref:`set_instance_transform_2d()<class_MultiMesh_method_set_instance_transform_2d>` and :ref:`get_instance_transform_2d()<class_MultiMesh_method_get_instance_transform_2d>` instead.
  195. Array containing each :ref:`Transform2D<class_Transform2D>` value used by all instances of this mesh, as a :ref:`PackedVector2Array<class_PackedVector2Array>`. Each transform is divided into 3 :ref:`Vector2<class_Vector2>` values corresponding to the transforms' ``x``, ``y``, and ``origin``.
  196. **Note:** The returned array is *copied* and any changes to it will not update the original property value. See :ref:`PackedVector2Array<class_PackedVector2Array>` for more details.
  197. .. rst-class:: classref-item-separator
  198. ----
  199. .. _class_MultiMesh_property_transform_array:
  200. .. rst-class:: classref-property
  201. :ref:`PackedVector3Array<class_PackedVector3Array>` **transform_array** :ref:`🔗<class_MultiMesh_property_transform_array>`
  202. **Deprecated:** Accessing this property is very slow. Use :ref:`set_instance_transform()<class_MultiMesh_method_set_instance_transform>` and :ref:`get_instance_transform()<class_MultiMesh_method_get_instance_transform>` instead.
  203. Array containing each :ref:`Transform3D<class_Transform3D>` value used by all instances of this mesh, as a :ref:`PackedVector3Array<class_PackedVector3Array>`. Each transform is divided into 4 :ref:`Vector3<class_Vector3>` values corresponding to the transforms' ``x``, ``y``, ``z``, and ``origin``.
  204. **Note:** The returned array is *copied* and any changes to it will not update the original property value. See :ref:`PackedVector3Array<class_PackedVector3Array>` for more details.
  205. .. rst-class:: classref-item-separator
  206. ----
  207. .. _class_MultiMesh_property_transform_format:
  208. .. rst-class:: classref-property
  209. :ref:`TransformFormat<enum_MultiMesh_TransformFormat>` **transform_format** = ``0`` :ref:`🔗<class_MultiMesh_property_transform_format>`
  210. .. rst-class:: classref-property-setget
  211. - |void| **set_transform_format**\ (\ value\: :ref:`TransformFormat<enum_MultiMesh_TransformFormat>`\ )
  212. - :ref:`TransformFormat<enum_MultiMesh_TransformFormat>` **get_transform_format**\ (\ )
  213. Format of transform used to transform mesh, either 2D or 3D.
  214. .. rst-class:: classref-item-separator
  215. ----
  216. .. _class_MultiMesh_property_use_colors:
  217. .. rst-class:: classref-property
  218. :ref:`bool<class_bool>` **use_colors** = ``false`` :ref:`🔗<class_MultiMesh_property_use_colors>`
  219. .. rst-class:: classref-property-setget
  220. - |void| **set_use_colors**\ (\ value\: :ref:`bool<class_bool>`\ )
  221. - :ref:`bool<class_bool>` **is_using_colors**\ (\ )
  222. If ``true``, the **MultiMesh** will use color data (see :ref:`set_instance_color()<class_MultiMesh_method_set_instance_color>`). Can only be set when :ref:`instance_count<class_MultiMesh_property_instance_count>` is ``0`` or less. This means that you need to call this method before setting the instance count, or temporarily reset it to ``0``.
  223. .. rst-class:: classref-item-separator
  224. ----
  225. .. _class_MultiMesh_property_use_custom_data:
  226. .. rst-class:: classref-property
  227. :ref:`bool<class_bool>` **use_custom_data** = ``false`` :ref:`🔗<class_MultiMesh_property_use_custom_data>`
  228. .. rst-class:: classref-property-setget
  229. - |void| **set_use_custom_data**\ (\ value\: :ref:`bool<class_bool>`\ )
  230. - :ref:`bool<class_bool>` **is_using_custom_data**\ (\ )
  231. If ``true``, the **MultiMesh** will use custom data (see :ref:`set_instance_custom_data()<class_MultiMesh_method_set_instance_custom_data>`). Can only be set when :ref:`instance_count<class_MultiMesh_property_instance_count>` is ``0`` or less. This means that you need to call this method before setting the instance count, or temporarily reset it to ``0``.
  232. .. rst-class:: classref-item-separator
  233. ----
  234. .. _class_MultiMesh_property_visible_instance_count:
  235. .. rst-class:: classref-property
  236. :ref:`int<class_int>` **visible_instance_count** = ``-1`` :ref:`🔗<class_MultiMesh_property_visible_instance_count>`
  237. .. rst-class:: classref-property-setget
  238. - |void| **set_visible_instance_count**\ (\ value\: :ref:`int<class_int>`\ )
  239. - :ref:`int<class_int>` **get_visible_instance_count**\ (\ )
  240. Limits the number of instances drawn, -1 draws all instances. Changing this does not change the sizes of the buffers.
  241. .. rst-class:: classref-section-separator
  242. ----
  243. .. rst-class:: classref-descriptions-group
  244. Method Descriptions
  245. -------------------
  246. .. _class_MultiMesh_method_get_aabb:
  247. .. rst-class:: classref-method
  248. :ref:`AABB<class_AABB>` **get_aabb**\ (\ ) |const| :ref:`🔗<class_MultiMesh_method_get_aabb>`
  249. Returns the visibility axis-aligned bounding box in local space.
  250. .. rst-class:: classref-item-separator
  251. ----
  252. .. _class_MultiMesh_method_get_instance_color:
  253. .. rst-class:: classref-method
  254. :ref:`Color<class_Color>` **get_instance_color**\ (\ instance\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_MultiMesh_method_get_instance_color>`
  255. Gets a specific instance's color multiplier.
  256. .. rst-class:: classref-item-separator
  257. ----
  258. .. _class_MultiMesh_method_get_instance_custom_data:
  259. .. rst-class:: classref-method
  260. :ref:`Color<class_Color>` **get_instance_custom_data**\ (\ instance\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_MultiMesh_method_get_instance_custom_data>`
  261. Returns the custom data that has been set for a specific instance.
  262. .. rst-class:: classref-item-separator
  263. ----
  264. .. _class_MultiMesh_method_get_instance_transform:
  265. .. rst-class:: classref-method
  266. :ref:`Transform3D<class_Transform3D>` **get_instance_transform**\ (\ instance\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_MultiMesh_method_get_instance_transform>`
  267. Returns the :ref:`Transform3D<class_Transform3D>` of a specific instance.
  268. .. rst-class:: classref-item-separator
  269. ----
  270. .. _class_MultiMesh_method_get_instance_transform_2d:
  271. .. rst-class:: classref-method
  272. :ref:`Transform2D<class_Transform2D>` **get_instance_transform_2d**\ (\ instance\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_MultiMesh_method_get_instance_transform_2d>`
  273. Returns the :ref:`Transform2D<class_Transform2D>` of a specific instance.
  274. .. rst-class:: classref-item-separator
  275. ----
  276. .. _class_MultiMesh_method_reset_instance_physics_interpolation:
  277. .. rst-class:: classref-method
  278. |void| **reset_instance_physics_interpolation**\ (\ instance\: :ref:`int<class_int>`\ ) :ref:`🔗<class_MultiMesh_method_reset_instance_physics_interpolation>`
  279. When using *physics interpolation*, this function allows you to prevent interpolation on an instance in the current physics tick.
  280. This allows you to move instances instantaneously, and should usually be used when initially placing an instance such as a bullet to prevent graphical glitches.
  281. .. rst-class:: classref-item-separator
  282. ----
  283. .. _class_MultiMesh_method_reset_instances_physics_interpolation:
  284. .. rst-class:: classref-method
  285. |void| **reset_instances_physics_interpolation**\ (\ ) :ref:`🔗<class_MultiMesh_method_reset_instances_physics_interpolation>`
  286. When using *physics interpolation*, this function allows you to prevent interpolation for all instances in the current physics tick.
  287. This allows you to move all instances instantaneously, and should usually be used when initially placing instances to prevent graphical glitches.
  288. .. rst-class:: classref-item-separator
  289. ----
  290. .. _class_MultiMesh_method_set_buffer_interpolated:
  291. .. rst-class:: classref-method
  292. |void| **set_buffer_interpolated**\ (\ buffer_curr\: :ref:`PackedFloat32Array<class_PackedFloat32Array>`, buffer_prev\: :ref:`PackedFloat32Array<class_PackedFloat32Array>`\ ) :ref:`🔗<class_MultiMesh_method_set_buffer_interpolated>`
  293. An alternative to setting the :ref:`buffer<class_MultiMesh_property_buffer>` property, which can be used with *physics interpolation*. This method takes two arrays, and can set the data for the current and previous tick in one go. The renderer will automatically interpolate the data at each frame.
  294. This is useful for situations where the order of instances may change from physics tick to tick, such as particle systems.
  295. When the order of instances is coherent, the simpler alternative of setting :ref:`buffer<class_MultiMesh_property_buffer>` can still be used with interpolation.
  296. .. rst-class:: classref-item-separator
  297. ----
  298. .. _class_MultiMesh_method_set_instance_color:
  299. .. rst-class:: classref-method
  300. |void| **set_instance_color**\ (\ instance\: :ref:`int<class_int>`, color\: :ref:`Color<class_Color>`\ ) :ref:`🔗<class_MultiMesh_method_set_instance_color>`
  301. Sets the color of a specific instance by *multiplying* the mesh's existing vertex colors. This allows for different color tinting per instance.
  302. \ **Note:** Each component is stored in 32 bits in the Forward+ and Mobile rendering methods, but is packed into 16 bits in the Compatibility rendering method.
  303. For the color to take effect, ensure that :ref:`use_colors<class_MultiMesh_property_use_colors>` is ``true`` on the **MultiMesh** and :ref:`BaseMaterial3D.vertex_color_use_as_albedo<class_BaseMaterial3D_property_vertex_color_use_as_albedo>` is ``true`` on the material. If you intend to set an absolute color instead of tinting, make sure the material's albedo color is set to pure white (``Color(1, 1, 1)``).
  304. .. rst-class:: classref-item-separator
  305. ----
  306. .. _class_MultiMesh_method_set_instance_custom_data:
  307. .. rst-class:: classref-method
  308. |void| **set_instance_custom_data**\ (\ instance\: :ref:`int<class_int>`, custom_data\: :ref:`Color<class_Color>`\ ) :ref:`🔗<class_MultiMesh_method_set_instance_custom_data>`
  309. Sets custom data for a specific instance. ``custom_data`` is a :ref:`Color<class_Color>` type only to contain 4 floating-point numbers.
  310. \ **Note:** Each number is stored in 32 bits in the Forward+ and Mobile rendering methods, but is packed into 16 bits in the Compatibility rendering method.
  311. For the custom data to be used, ensure that :ref:`use_custom_data<class_MultiMesh_property_use_custom_data>` is ``true``.
  312. This custom instance data has to be manually accessed in your custom shader using ``INSTANCE_CUSTOM``.
  313. .. rst-class:: classref-item-separator
  314. ----
  315. .. _class_MultiMesh_method_set_instance_transform:
  316. .. rst-class:: classref-method
  317. |void| **set_instance_transform**\ (\ instance\: :ref:`int<class_int>`, transform\: :ref:`Transform3D<class_Transform3D>`\ ) :ref:`🔗<class_MultiMesh_method_set_instance_transform>`
  318. Sets the :ref:`Transform3D<class_Transform3D>` for a specific instance.
  319. .. rst-class:: classref-item-separator
  320. ----
  321. .. _class_MultiMesh_method_set_instance_transform_2d:
  322. .. rst-class:: classref-method
  323. |void| **set_instance_transform_2d**\ (\ instance\: :ref:`int<class_int>`, transform\: :ref:`Transform2D<class_Transform2D>`\ ) :ref:`🔗<class_MultiMesh_method_set_instance_transform_2d>`
  324. Sets the :ref:`Transform2D<class_Transform2D>` for a specific instance.
  325. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  326. .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
  327. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  328. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  329. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  330. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  331. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  332. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  333. .. |void| replace:: :abbr:`void (No return value.)`