mirror of
https://github.com/Relintai/pandemonium_engine_docs.git
synced 2025-01-23 15:17:21 +01:00
111 lines
4.2 KiB
ReStructuredText
111 lines
4.2 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. DO NOT EDIT THIS FILE!!!
|
|
.. Generated automatically from Godot engine sources.
|
|
.. Generator: https://github.com/godotengine/godot/tree/3.5/doc/tools/make_rst.py.
|
|
.. XML source: https://github.com/godotengine/godot/tree/3.5/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.
|
|
|
|
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.
|
|
|
|
Tutorials
|
|
---------
|
|
|
|
- `2D Dodge The Creeps Demo <https://godotengine.org/asset-library/asset/515>`__
|
|
|
|
Properties
|
|
----------
|
|
|
|
+---------------------------+-------------------------------------------------------+-------------------------------+
|
|
| :ref:`Rect2<class_Rect2>` | :ref:`rect<class_VisibilityNotifier2D_property_rect>` | ``Rect2( -10, -10, 20, 20 )`` |
|
|
+---------------------------+-------------------------------------------------------+-------------------------------+
|
|
|
|
Methods
|
|
-------
|
|
|
|
+-------------------------+-----------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_on_screen<class_VisibilityNotifier2D_method_is_on_screen>` **(** **)** |const| |
|
|
+-------------------------+-----------------------------------------------------------------------------------------+
|
|
|
|
Signals
|
|
-------
|
|
|
|
.. _class_VisibilityNotifier2D_signal_screen_entered:
|
|
|
|
- **screen_entered** **(** **)**
|
|
|
|
Emitted when the VisibilityNotifier2D enters the screen.
|
|
|
|
----
|
|
|
|
.. _class_VisibilityNotifier2D_signal_screen_exited:
|
|
|
|
- **screen_exited** **(** **)**
|
|
|
|
Emitted when the VisibilityNotifier2D exits the screen.
|
|
|
|
----
|
|
|
|
.. _class_VisibilityNotifier2D_signal_viewport_entered:
|
|
|
|
- **viewport_entered** **(** :ref:`Viewport<class_Viewport>` viewport **)**
|
|
|
|
Emitted when the VisibilityNotifier2D enters a :ref:`Viewport<class_Viewport>`'s view.
|
|
|
|
----
|
|
|
|
.. _class_VisibilityNotifier2D_signal_viewport_exited:
|
|
|
|
- **viewport_exited** **(** :ref:`Viewport<class_Viewport>` viewport **)**
|
|
|
|
Emitted when the VisibilityNotifier2D exits a :ref:`Viewport<class_Viewport>`'s view.
|
|
|
|
Property Descriptions
|
|
---------------------
|
|
|
|
.. _class_VisibilityNotifier2D_property_rect:
|
|
|
|
- :ref:`Rect2<class_Rect2>` **rect**
|
|
|
|
+-----------+-------------------------------+
|
|
| *Default* | ``Rect2( -10, -10, 20, 20 )`` |
|
|
+-----------+-------------------------------+
|
|
| *Setter* | set_rect(value) |
|
|
+-----------+-------------------------------+
|
|
| *Getter* | get_rect() |
|
|
+-----------+-------------------------------+
|
|
|
|
The VisibilityNotifier2D's bounding rectangle.
|
|
|
|
Method Descriptions
|
|
-------------------
|
|
|
|
.. _class_VisibilityNotifier2D_method_is_on_screen:
|
|
|
|
- :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.)`
|