class_visualinstance.rst 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/VisualInstance.xml.
  6. .. _class_VisualInstance:
  7. VisualInstance
  8. ==============
  9. **Inherits:** :ref:`CullInstance<class_CullInstance>` **<** :ref:`Spatial<class_Spatial>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`BakedLightmap<class_BakedLightmap>`, :ref:`GeometryInstance<class_GeometryInstance>`, :ref:`GIProbe<class_GIProbe>`, :ref:`Light<class_Light>`, :ref:`ReflectionProbe<class_ReflectionProbe>`, :ref:`RootMotionView<class_RootMotionView>`
  11. Parent of all visual 3D nodes.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. The **VisualInstance** is used to connect a resource to a visual representation. All visual 3D nodes inherit from the **VisualInstance**. In general, you should not access the **VisualInstance** properties directly as they are accessed and managed by the nodes that inherit from **VisualInstance**. **VisualInstance** is the node representation of the :ref:`VisualServer<class_VisualServer>` instance.
  16. .. rst-class:: classref-reftable-group
  17. Properties
  18. ----------
  19. .. table::
  20. :widths: auto
  21. +---------------------------+---------------------------------------------------------------------------------------+----------+
  22. | :ref:`int<class_int>` | :ref:`layers<class_VisualInstance_property_layers>` | ``1`` |
  23. +---------------------------+---------------------------------------------------------------------------------------+----------+
  24. | :ref:`float<class_float>` | :ref:`sorting_offset<class_VisualInstance_property_sorting_offset>` | ``0.0`` |
  25. +---------------------------+---------------------------------------------------------------------------------------+----------+
  26. | :ref:`bool<class_bool>` | :ref:`sorting_use_aabb_center<class_VisualInstance_property_sorting_use_aabb_center>` | ``true`` |
  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_VisualInstance_method_get_aabb>` **(** **)** |const| |
  35. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`RID<class_RID>` | :ref:`get_base<class_VisualInstance_method_get_base>` **(** **)** |const| |
  37. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`RID<class_RID>` | :ref:`get_instance<class_VisualInstance_method_get_instance>` **(** **)** |const| |
  39. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`bool<class_bool>` | :ref:`get_layer_mask_bit<class_VisualInstance_method_get_layer_mask_bit>` **(** :ref:`int<class_int>` layer **)** |const| |
  41. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`AABB<class_AABB>` | :ref:`get_transformed_aabb<class_VisualInstance_method_get_transformed_aabb>` **(** **)** |const| |
  43. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | void | :ref:`set_base<class_VisualInstance_method_set_base>` **(** :ref:`RID<class_RID>` base **)** |
  45. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | void | :ref:`set_layer_mask_bit<class_VisualInstance_method_set_layer_mask_bit>` **(** :ref:`int<class_int>` layer, :ref:`bool<class_bool>` enabled **)** |
  47. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
  48. .. rst-class:: classref-section-separator
  49. ----
  50. .. rst-class:: classref-descriptions-group
  51. Property Descriptions
  52. ---------------------
  53. .. _class_VisualInstance_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 **VisualInstance** is drawn on.
  60. This object will only be visible for :ref:`Camera<class_Camera>`\ s whose cull mask includes the render object this **VisualInstance** is set to.
  61. .. rst-class:: classref-item-separator
  62. ----
  63. .. _class_VisualInstance_property_sorting_offset:
  64. .. rst-class:: classref-property
  65. :ref:`float<class_float>` **sorting_offset** = ``0.0``
  66. .. rst-class:: classref-property-setget
  67. - void **set_sorting_offset** **(** :ref:`float<class_float>` value **)**
  68. - :ref:`float<class_float>` **get_sorting_offset** **(** **)**
  69. The sorting offset used by this **VisualInstance**. Adjusting it to a higher value will make the **VisualInstance** reliably draw on top of other **VisualInstance**\ s that are otherwise positioned at the same spot.
  70. .. rst-class:: classref-item-separator
  71. ----
  72. .. _class_VisualInstance_property_sorting_use_aabb_center:
  73. .. rst-class:: classref-property
  74. :ref:`bool<class_bool>` **sorting_use_aabb_center** = ``true``
  75. .. rst-class:: classref-property-setget
  76. - void **set_sorting_use_aabb_center** **(** :ref:`bool<class_bool>` value **)**
  77. - :ref:`bool<class_bool>` **is_sorting_use_aabb_center** **(** **)**
  78. If ``true``, the object is sorted based on the :ref:`AABB<class_AABB>` center. Sorted based on the global position otherwise.
  79. 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:`Particles<class_Particles>` and :ref:`CPUParticles<class_CPUParticles>`.
  80. .. rst-class:: classref-section-separator
  81. ----
  82. .. rst-class:: classref-descriptions-group
  83. Method Descriptions
  84. -------------------
  85. .. _class_VisualInstance_method_get_aabb:
  86. .. rst-class:: classref-method
  87. :ref:`AABB<class_AABB>` **get_aabb** **(** **)** |const|
  88. Returns the :ref:`AABB<class_AABB>` (also known as the bounding box) for this **VisualInstance**. See also :ref:`get_transformed_aabb<class_VisualInstance_method_get_transformed_aabb>`.
  89. .. rst-class:: classref-item-separator
  90. ----
  91. .. _class_VisualInstance_method_get_base:
  92. .. rst-class:: classref-method
  93. :ref:`RID<class_RID>` **get_base** **(** **)** |const|
  94. Returns the RID of the resource associated with this **VisualInstance**. For example, if the Node is a :ref:`MeshInstance<class_MeshInstance>`, this will return the RID of the associated :ref:`Mesh<class_Mesh>`.
  95. .. rst-class:: classref-item-separator
  96. ----
  97. .. _class_VisualInstance_method_get_instance:
  98. .. rst-class:: classref-method
  99. :ref:`RID<class_RID>` **get_instance** **(** **)** |const|
  100. Returns the RID of this instance. This RID is the same as the RID returned by :ref:`VisualServer.instance_create<class_VisualServer_method_instance_create>`. This RID is needed if you want to call :ref:`VisualServer<class_VisualServer>` functions directly on this **VisualInstance**.
  101. .. rst-class:: classref-item-separator
  102. ----
  103. .. _class_VisualInstance_method_get_layer_mask_bit:
  104. .. rst-class:: classref-method
  105. :ref:`bool<class_bool>` **get_layer_mask_bit** **(** :ref:`int<class_int>` layer **)** |const|
  106. Returns ``true`` when the specified layer is enabled in :ref:`layers<class_VisualInstance_property_layers>` and ``false`` otherwise.
  107. .. rst-class:: classref-item-separator
  108. ----
  109. .. _class_VisualInstance_method_get_transformed_aabb:
  110. .. rst-class:: classref-method
  111. :ref:`AABB<class_AABB>` **get_transformed_aabb** **(** **)** |const|
  112. Returns the transformed :ref:`AABB<class_AABB>` (also known as the bounding box) for this **VisualInstance**.
  113. Transformed in this case means the :ref:`AABB<class_AABB>` plus the position, rotation, and scale of the :ref:`Spatial<class_Spatial>`'s :ref:`Transform<class_Transform>`. See also :ref:`get_aabb<class_VisualInstance_method_get_aabb>`.
  114. .. rst-class:: classref-item-separator
  115. ----
  116. .. _class_VisualInstance_method_set_base:
  117. .. rst-class:: classref-method
  118. void **set_base** **(** :ref:`RID<class_RID>` base **)**
  119. Sets the resource that is instantiated by this **VisualInstance**, which changes how the engine handles the **VisualInstance** under the hood. Equivalent to :ref:`VisualServer.instance_set_base<class_VisualServer_method_instance_set_base>`.
  120. .. rst-class:: classref-item-separator
  121. ----
  122. .. _class_VisualInstance_method_set_layer_mask_bit:
  123. .. rst-class:: classref-method
  124. void **set_layer_mask_bit** **(** :ref:`int<class_int>` layer, :ref:`bool<class_bool>` enabled **)**
  125. Enables a particular layer in :ref:`layers<class_VisualInstance_property_layers>`.
  126. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  127. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  128. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  129. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`