virtualx-engine-docs/_sources/classes/class_visibilitynotifier2d.rst.txt
2024-10-23 09:41:33 -07:00

158 lines
5 KiB
ReStructuredText

:github_url: hide
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/VisibilityNotifier2D.xml.
.. _class_VisibilityNotifier2D:
VisibilityNotifier2D
====================
**Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
**Inherited By:** :ref:`VisibilityEnabler2D<class_VisibilityEnabler2D>`
Detects approximately when the node is visible on screen.
.. rst-class:: classref-introduction-group
Description
-----------
The VisibilityNotifier2D detects when it is visible on the screen. It also notifies when its bounding rectangle enters or exits the screen or a viewport.
If you want nodes to be disabled automatically when they exit the screen, use :ref:`VisibilityEnabler2D<class_VisibilityEnabler2D>` instead.
\ **Note:** For performance reasons, VisibilityNotifier2D uses an approximate heuristic with precision determined by :ref:`ProjectSettings.world/2d/cell_size<class_ProjectSettings_property_world/2d/cell_size>`. If you need precise visibility checking, use another method such as adding an :ref:`Area2D<class_Area2D>` node as a child of a :ref:`Camera2D<class_Camera2D>` node.
.. rst-class:: classref-introduction-group
Tutorials
---------
- `2D Dodge The Creeps Demo <https://godotengine.org/asset-library/asset/515>`__
.. rst-class:: classref-reftable-group
Properties
----------
.. table::
:widths: auto
+---------------------------+-------------------------------------------------------+-------------------------------+
| :ref:`Rect2<class_Rect2>` | :ref:`rect<class_VisibilityNotifier2D_property_rect>` | ``Rect2( -10, -10, 20, 20 )`` |
+---------------------------+-------------------------------------------------------+-------------------------------+
.. rst-class:: classref-reftable-group
Methods
-------
.. table::
:widths: auto
+-------------------------+-----------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_on_screen<class_VisibilityNotifier2D_method_is_on_screen>` **(** **)** |const| |
+-------------------------+-----------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Signals
-------
.. _class_VisibilityNotifier2D_signal_screen_entered:
.. rst-class:: classref-signal
**screen_entered** **(** **)**
Emitted when the VisibilityNotifier2D enters the screen.
.. rst-class:: classref-item-separator
----
.. _class_VisibilityNotifier2D_signal_screen_exited:
.. rst-class:: classref-signal
**screen_exited** **(** **)**
Emitted when the VisibilityNotifier2D exits the screen.
.. rst-class:: classref-item-separator
----
.. _class_VisibilityNotifier2D_signal_viewport_entered:
.. rst-class:: classref-signal
**viewport_entered** **(** :ref:`Viewport<class_Viewport>` viewport **)**
Emitted when the VisibilityNotifier2D enters a :ref:`Viewport<class_Viewport>`'s view.
.. rst-class:: classref-item-separator
----
.. _class_VisibilityNotifier2D_signal_viewport_exited:
.. rst-class:: classref-signal
**viewport_exited** **(** :ref:`Viewport<class_Viewport>` viewport **)**
Emitted when the VisibilityNotifier2D exits a :ref:`Viewport<class_Viewport>`'s view.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Property Descriptions
---------------------
.. _class_VisibilityNotifier2D_property_rect:
.. rst-class:: classref-property
:ref:`Rect2<class_Rect2>` **rect** = ``Rect2( -10, -10, 20, 20 )``
.. rst-class:: classref-property-setget
- void **set_rect** **(** :ref:`Rect2<class_Rect2>` value **)**
- :ref:`Rect2<class_Rect2>` **get_rect** **(** **)**
The VisibilityNotifier2D's bounding rectangle.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Method Descriptions
-------------------
.. _class_VisibilityNotifier2D_method_is_on_screen:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_on_screen** **(** **)** |const|
If ``true``, the bounding rectangle is on the screen.
\ **Note:** It takes one frame for the node's visibility to be assessed once added to the scene tree, so this method will return ``false`` right after it is instantiated, even if it will be on screen in the draw pass.
.. |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.)`
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`