class_visualinstance.rst 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the VisualInstance.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_VisualInstance:
  6. VisualInstance
  7. ==============
  8. **Inherits:** :ref:`Spatial<class_Spatial>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. **Inherited By:** :ref:`BakedLightmap<class_BakedLightmap>`, :ref:`GIProbe<class_GIProbe>`, :ref:`GeometryInstance<class_GeometryInstance>`, :ref:`Light<class_Light>`, :ref:`ReflectionProbe<class_ReflectionProbe>`, :ref:`RootMotionView<class_RootMotionView>`
  10. Parent of all visual 3D nodes.
  11. Description
  12. -----------
  13. 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.
  14. Properties
  15. ----------
  16. +-----------------------+-----------------------------------------------------+-------+
  17. | :ref:`int<class_int>` | :ref:`layers<class_VisualInstance_property_layers>` | ``1`` |
  18. +-----------------------+-----------------------------------------------------+-------+
  19. Methods
  20. -------
  21. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`AABB<class_AABB>` | :ref:`get_aabb<class_VisualInstance_method_get_aabb>` **(** **)** const |
  23. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`RID<class_RID>` | :ref:`get_base<class_VisualInstance_method_get_base>` **(** **)** const |
  25. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`RID<class_RID>` | :ref:`get_instance<class_VisualInstance_method_get_instance>` **(** **)** const |
  27. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`bool<class_bool>` | :ref:`get_layer_mask_bit<class_VisualInstance_method_get_layer_mask_bit>` **(** :ref:`int<class_int>` layer **)** const |
  29. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`AABB<class_AABB>` | :ref:`get_transformed_aabb<class_VisualInstance_method_get_transformed_aabb>` **(** **)** const |
  31. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | void | :ref:`set_base<class_VisualInstance_method_set_base>` **(** :ref:`RID<class_RID>` base **)** |
  33. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | void | :ref:`set_layer_mask_bit<class_VisualInstance_method_set_layer_mask_bit>` **(** :ref:`int<class_int>` layer, :ref:`bool<class_bool>` enabled **)** |
  35. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
  36. Property Descriptions
  37. ---------------------
  38. .. _class_VisualInstance_property_layers:
  39. - :ref:`int<class_int>` **layers**
  40. +-----------+-----------------------+
  41. | *Default* | ``1`` |
  42. +-----------+-----------------------+
  43. | *Setter* | set_layer_mask(value) |
  44. +-----------+-----------------------+
  45. | *Getter* | get_layer_mask() |
  46. +-----------+-----------------------+
  47. The render layer(s) this VisualInstance is drawn on.
  48. This object will only be visible for :ref:`Camera<class_Camera>`\ s whose cull mask includes the render object this VisualInstance is set to.
  49. Method Descriptions
  50. -------------------
  51. .. _class_VisualInstance_method_get_aabb:
  52. - :ref:`AABB<class_AABB>` **get_aabb** **(** **)** const
  53. Returns the :ref:`AABB<class_AABB>` (also known as the bounding box) for this VisualInstance.
  54. ----
  55. .. _class_VisualInstance_method_get_base:
  56. - :ref:`RID<class_RID>` **get_base** **(** **)** const
  57. 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>`.
  58. ----
  59. .. _class_VisualInstance_method_get_instance:
  60. - :ref:`RID<class_RID>` **get_instance** **(** **)** const
  61. 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.
  62. ----
  63. .. _class_VisualInstance_method_get_layer_mask_bit:
  64. - :ref:`bool<class_bool>` **get_layer_mask_bit** **(** :ref:`int<class_int>` layer **)** const
  65. Returns ``true`` when the specified layer is enabled in :ref:`layers<class_VisualInstance_property_layers>` and ``false`` otherwise.
  66. ----
  67. .. _class_VisualInstance_method_get_transformed_aabb:
  68. - :ref:`AABB<class_AABB>` **get_transformed_aabb** **(** **)** const
  69. Returns the transformed :ref:`AABB<class_AABB>` (also known as the bounding box) for this VisualInstance.
  70. 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>`
  71. ----
  72. .. _class_VisualInstance_method_set_base:
  73. - void **set_base** **(** :ref:`RID<class_RID>` base **)**
  74. 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>`.
  75. ----
  76. .. _class_VisualInstance_method_set_layer_mask_bit:
  77. - void **set_layer_mask_bit** **(** :ref:`int<class_int>` layer, :ref:`bool<class_bool>` enabled **)**
  78. Enables a particular layer in :ref:`layers<class_VisualInstance_property_layers>`.