:github_url: hide .. Generated automatically by doc/tools/make_rst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the VisualInstance.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_VisualInstance: VisualInstance ============== **Inherits:** :ref:`CullInstance` **<** :ref:`Spatial` **<** :ref:`Node` **<** :ref:`Object` **Inherited By:** :ref:`BakedLightmap`, :ref:`GIProbe`, :ref:`GeometryInstance`, :ref:`Light`, :ref:`ReflectionProbe`, :ref:`RootMotionView` Parent of all visual 3D nodes. Description ----------- 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` instance. Properties ---------- +-----------------------+-----------------------------------------------------+-------+ | :ref:`int` | :ref:`layers` | ``1`` | +-----------------------+-----------------------------------------------------+-------+ Methods ------- +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`AABB` | :ref:`get_aabb` **(** **)** |const| | +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`RID` | :ref:`get_base` **(** **)** |const| | +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`RID` | :ref:`get_instance` **(** **)** |const| | +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`get_layer_mask_bit` **(** :ref:`int` layer **)** |const| | +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`AABB` | :ref:`get_transformed_aabb` **(** **)** |const| | +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_base` **(** :ref:`RID` base **)** | +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_layer_mask_bit` **(** :ref:`int` layer, :ref:`bool` enabled **)** | +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+ Property Descriptions --------------------- .. _class_VisualInstance_property_layers: - :ref:`int` **layers** +-----------+-----------------------+ | *Default* | ``1`` | +-----------+-----------------------+ | *Setter* | set_layer_mask(value) | +-----------+-----------------------+ | *Getter* | get_layer_mask() | +-----------+-----------------------+ The render layer(s) this ``VisualInstance`` is drawn on. This object will only be visible for :ref:`Camera`\ s whose cull mask includes the render object this ``VisualInstance`` is set to. Method Descriptions ------------------- .. _class_VisualInstance_method_get_aabb: - :ref:`AABB` **get_aabb** **(** **)** |const| Returns the :ref:`AABB` (also known as the bounding box) for this ``VisualInstance``. See also :ref:`get_transformed_aabb`. ---- .. _class_VisualInstance_method_get_base: - :ref:`RID` **get_base** **(** **)** |const| Returns the RID of the resource associated with this ``VisualInstance``. For example, if the Node is a :ref:`MeshInstance`, this will return the RID of the associated :ref:`Mesh`. ---- .. _class_VisualInstance_method_get_instance: - :ref:`RID` **get_instance** **(** **)** |const| Returns the RID of this instance. This RID is the same as the RID returned by :ref:`VisualServer.instance_create`. This RID is needed if you want to call :ref:`VisualServer` functions directly on this ``VisualInstance``. ---- .. _class_VisualInstance_method_get_layer_mask_bit: - :ref:`bool` **get_layer_mask_bit** **(** :ref:`int` layer **)** |const| Returns ``true`` when the specified layer is enabled in :ref:`layers` and ``false`` otherwise. ---- .. _class_VisualInstance_method_get_transformed_aabb: - :ref:`AABB` **get_transformed_aabb** **(** **)** |const| Returns the transformed :ref:`AABB` (also known as the bounding box) for this ``VisualInstance``. Transformed in this case means the :ref:`AABB` plus the position, rotation, and scale of the :ref:`Spatial`'s :ref:`Transform`. See also :ref:`get_aabb`. ---- .. _class_VisualInstance_method_set_base: - void **set_base** **(** :ref:`RID` base **)** 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_VisualInstance_method_set_layer_mask_bit: - void **set_layer_mask_bit** **(** :ref:`int` layer, :ref:`bool` enabled **)** Enables a particular layer in :ref:`layers`. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`