class_visualinstance3d.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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/VisualInstance3D.xml.
  6. .. _class_VisualInstance3D:
  7. VisualInstance3D
  8. ================
  9. **Inherits:** :ref:`Node3D<class_Node3D>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`Decal<class_Decal>`, :ref:`FogVolume<class_FogVolume>`, :ref:`GeometryInstance3D<class_GeometryInstance3D>`, :ref:`GPUParticlesAttractor3D<class_GPUParticlesAttractor3D>`, :ref:`GPUParticlesCollision3D<class_GPUParticlesCollision3D>`, :ref:`Light3D<class_Light3D>`, :ref:`LightmapGI<class_LightmapGI>`, :ref:`ReflectionProbe<class_ReflectionProbe>`, :ref:`RootMotionView<class_RootMotionView>`, :ref:`VisibleOnScreenNotifier3D<class_VisibleOnScreenNotifier3D>`, :ref:`VoxelGI<class_VoxelGI>`
  11. Parent of all visual 3D nodes.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. The **VisualInstance3D** is used to connect a resource to a visual representation. All visual 3D nodes inherit from the **VisualInstance3D**. In general, you should not access the **VisualInstance3D** properties directly as they are accessed and managed by the nodes that inherit from **VisualInstance3D**. **VisualInstance3D** is the node representation of the :ref:`RenderingServer<class_RenderingServer>` instance.
  16. .. rst-class:: classref-reftable-group
  17. Properties
  18. ----------
  19. .. table::
  20. :widths: auto
  21. +---------------------------+-----------------------------------------------------------------------------------------+---------+
  22. | :ref:`int<class_int>` | :ref:`layers<class_VisualInstance3D_property_layers>` | ``1`` |
  23. +---------------------------+-----------------------------------------------------------------------------------------+---------+
  24. | :ref:`float<class_float>` | :ref:`sorting_offset<class_VisualInstance3D_property_sorting_offset>` | ``0.0`` |
  25. +---------------------------+-----------------------------------------------------------------------------------------+---------+
  26. | :ref:`bool<class_bool>` | :ref:`sorting_use_aabb_center<class_VisualInstance3D_property_sorting_use_aabb_center>` | |
  27. +---------------------------+-----------------------------------------------------------------------------------------+---------+
  28. .. rst-class:: classref-reftable-group
  29. Methods
  30. -------
  31. .. table::
  32. :widths: auto
  33. +-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`AABB<class_AABB>` | :ref:`_get_aabb<class_VisualInstance3D_private_method__get_aabb>` **(** **)** |virtual| |const| |
  35. +-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`AABB<class_AABB>` | :ref:`get_aabb<class_VisualInstance3D_method_get_aabb>` **(** **)** |const| |
  37. +-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`RID<class_RID>` | :ref:`get_base<class_VisualInstance3D_method_get_base>` **(** **)** |const| |
  39. +-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`RID<class_RID>` | :ref:`get_instance<class_VisualInstance3D_method_get_instance>` **(** **)** |const| |
  41. +-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`bool<class_bool>` | :ref:`get_layer_mask_value<class_VisualInstance3D_method_get_layer_mask_value>` **(** :ref:`int<class_int>` layer_number **)** |const| |
  43. +-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | void | :ref:`set_base<class_VisualInstance3D_method_set_base>` **(** :ref:`RID<class_RID>` base **)** |
  45. +-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | void | :ref:`set_layer_mask_value<class_VisualInstance3D_method_set_layer_mask_value>` **(** :ref:`int<class_int>` layer_number, :ref:`bool<class_bool>` value **)** |
  47. +-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. .. rst-class:: classref-section-separator
  49. ----
  50. .. rst-class:: classref-descriptions-group
  51. Property Descriptions
  52. ---------------------
  53. .. _class_VisualInstance3D_property_layers:
  54. .. rst-class:: classref-property
  55. :ref:`int<class_int>` **layers** = ``1``
  56. .. rst-class:: classref-property-setget
  57. - void **set_layer_mask** **(** :ref:`int<class_int>` value **)**
  58. - :ref:`int<class_int>` **get_layer_mask** **(** **)**
  59. The render layer(s) this **VisualInstance3D** is drawn on.
  60. This object will only be visible for :ref:`Camera3D<class_Camera3D>`\ s whose cull mask includes any of the render layers this **VisualInstance3D** is set to.
  61. For :ref:`Light3D<class_Light3D>`\ s, this can be used to control which **VisualInstance3D**\ s are affected by a specific light. For :ref:`GPUParticles3D<class_GPUParticles3D>`, this can be used to control which particles are effected by a specific attractor. For :ref:`Decal<class_Decal>`\ s, this can be used to control which **VisualInstance3D**\ s are affected by a specific decal.
  62. To adjust :ref:`layers<class_VisualInstance3D_property_layers>` more easily using a script, use :ref:`get_layer_mask_value<class_VisualInstance3D_method_get_layer_mask_value>` and :ref:`set_layer_mask_value<class_VisualInstance3D_method_set_layer_mask_value>`.
  63. \ **Note:** :ref:`VoxelGI<class_VoxelGI>`, SDFGI and :ref:`LightmapGI<class_LightmapGI>` will always take all layers into account to determine what contributes to global illumination. If this is an issue, set :ref:`GeometryInstance3D.gi_mode<class_GeometryInstance3D_property_gi_mode>` to :ref:`GeometryInstance3D.GI_MODE_DISABLED<class_GeometryInstance3D_constant_GI_MODE_DISABLED>` for meshes and :ref:`Light3D.light_bake_mode<class_Light3D_property_light_bake_mode>` to :ref:`Light3D.BAKE_DISABLED<class_Light3D_constant_BAKE_DISABLED>` for lights to exclude them from global illumination.
  64. .. rst-class:: classref-item-separator
  65. ----
  66. .. _class_VisualInstance3D_property_sorting_offset:
  67. .. rst-class:: classref-property
  68. :ref:`float<class_float>` **sorting_offset** = ``0.0``
  69. .. rst-class:: classref-property-setget
  70. - void **set_sorting_offset** **(** :ref:`float<class_float>` value **)**
  71. - :ref:`float<class_float>` **get_sorting_offset** **(** **)**
  72. The amount by which the depth of this **VisualInstance3D** will be adjusted when sorting by depth. Uses the same units as the engine (which are typically meters). Adjusting it to a higher value will make the **VisualInstance3D** reliably draw on top of other **VisualInstance3D**\ s that are otherwise positioned at the same spot. To ensure it always draws on top of other objects around it (not positioned at the same spot), set the value to be greater than the distance between this **VisualInstance3D** and the other nearby **VisualInstance3D**\ s.
  73. .. rst-class:: classref-item-separator
  74. ----
  75. .. _class_VisualInstance3D_property_sorting_use_aabb_center:
  76. .. rst-class:: classref-property
  77. :ref:`bool<class_bool>` **sorting_use_aabb_center**
  78. .. rst-class:: classref-property-setget
  79. - void **set_sorting_use_aabb_center** **(** :ref:`bool<class_bool>` value **)**
  80. - :ref:`bool<class_bool>` **is_sorting_use_aabb_center** **(** **)**
  81. If ``true``, the object is sorted based on the :ref:`AABB<class_AABB>` center. The object will be sorted based on the global position otherwise.
  82. The :ref:`AABB<class_AABB>` center based sorting is generally more accurate for 3D models. The position based sorting instead allows to better control the drawing order when working with :ref:`GPUParticles3D<class_GPUParticles3D>` and :ref:`CPUParticles3D<class_CPUParticles3D>`.
  83. .. rst-class:: classref-section-separator
  84. ----
  85. .. rst-class:: classref-descriptions-group
  86. Method Descriptions
  87. -------------------
  88. .. _class_VisualInstance3D_private_method__get_aabb:
  89. .. rst-class:: classref-method
  90. :ref:`AABB<class_AABB>` **_get_aabb** **(** **)** |virtual| |const|
  91. .. container:: contribute
  92. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  93. .. rst-class:: classref-item-separator
  94. ----
  95. .. _class_VisualInstance3D_method_get_aabb:
  96. .. rst-class:: classref-method
  97. :ref:`AABB<class_AABB>` **get_aabb** **(** **)** |const|
  98. Returns the :ref:`AABB<class_AABB>` (also known as the bounding box) for this **VisualInstance3D**.
  99. .. rst-class:: classref-item-separator
  100. ----
  101. .. _class_VisualInstance3D_method_get_base:
  102. .. rst-class:: classref-method
  103. :ref:`RID<class_RID>` **get_base** **(** **)** |const|
  104. Returns the RID of the resource associated with this **VisualInstance3D**. For example, if the Node is a :ref:`MeshInstance3D<class_MeshInstance3D>`, this will return the RID of the associated :ref:`Mesh<class_Mesh>`.
  105. .. rst-class:: classref-item-separator
  106. ----
  107. .. _class_VisualInstance3D_method_get_instance:
  108. .. rst-class:: classref-method
  109. :ref:`RID<class_RID>` **get_instance** **(** **)** |const|
  110. Returns the RID of this instance. This RID is the same as the RID returned by :ref:`RenderingServer.instance_create<class_RenderingServer_method_instance_create>`. This RID is needed if you want to call :ref:`RenderingServer<class_RenderingServer>` functions directly on this **VisualInstance3D**.
  111. .. rst-class:: classref-item-separator
  112. ----
  113. .. _class_VisualInstance3D_method_get_layer_mask_value:
  114. .. rst-class:: classref-method
  115. :ref:`bool<class_bool>` **get_layer_mask_value** **(** :ref:`int<class_int>` layer_number **)** |const|
  116. Returns whether or not the specified layer of the :ref:`layers<class_VisualInstance3D_property_layers>` is enabled, given a ``layer_number`` between 1 and 20.
  117. .. rst-class:: classref-item-separator
  118. ----
  119. .. _class_VisualInstance3D_method_set_base:
  120. .. rst-class:: classref-method
  121. void **set_base** **(** :ref:`RID<class_RID>` base **)**
  122. Sets the resource that is instantiated by this **VisualInstance3D**, which changes how the engine handles the **VisualInstance3D** under the hood. Equivalent to :ref:`RenderingServer.instance_set_base<class_RenderingServer_method_instance_set_base>`.
  123. .. rst-class:: classref-item-separator
  124. ----
  125. .. _class_VisualInstance3D_method_set_layer_mask_value:
  126. .. rst-class:: classref-method
  127. void **set_layer_mask_value** **(** :ref:`int<class_int>` layer_number, :ref:`bool<class_bool>` value **)**
  128. Based on ``value``, enables or disables the specified layer in the :ref:`layers<class_VisualInstance3D_property_layers>`, given a ``layer_number`` between 1 and 20.
  129. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  130. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  131. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  132. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  133. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  134. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  135. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`