class_visibilitynotifier.rst 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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/VisibilityNotifier.xml.
  6. .. _class_VisibilityNotifier:
  7. VisibilityNotifier
  8. ==================
  9. **Inherits:** :ref:`CullInstance<class_CullInstance>` **<** :ref:`Spatial<class_Spatial>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`VisibilityEnabler<class_VisibilityEnabler>`
  11. Detects approximately when the node is visible on screen.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. The VisibilityNotifier detects when it is visible on the screen. It also notifies when its bounding rectangle enters or exits the screen or a :ref:`Camera<class_Camera>`'s view.
  16. If you want nodes to be disabled automatically when they exit the screen, use :ref:`VisibilityEnabler<class_VisibilityEnabler>` instead.
  17. \ **Note:** VisibilityNotifier uses an approximate heuristic for performance reasons. It doesn't take walls and other occlusion into account (unless you are using :ref:`Portal<class_Portal>`\ s). The heuristic is an implementation detail and may change in future versions. If you need precise visibility checking, use another method such as adding an :ref:`Area<class_Area>` node as a child of a :ref:`Camera<class_Camera>` node and/or :ref:`Vector3.dot<class_Vector3_method_dot>`.
  18. .. rst-class:: classref-reftable-group
  19. Properties
  20. ----------
  21. .. table::
  22. :widths: auto
  23. +---------------------------+---------------------------------------------------------------------+---------------------------------+
  24. | :ref:`AABB<class_AABB>` | :ref:`aabb<class_VisibilityNotifier_property_aabb>` | ``AABB( -1, -1, -1, 2, 2, 2 )`` |
  25. +---------------------------+---------------------------------------------------------------------+---------------------------------+
  26. | :ref:`float<class_float>` | :ref:`max_distance<class_VisibilityNotifier_property_max_distance>` | ``0.0`` |
  27. +---------------------------+---------------------------------------------------------------------+---------------------------------+
  28. .. rst-class:: classref-reftable-group
  29. Methods
  30. -------
  31. .. table::
  32. :widths: auto
  33. +-------------------------+---------------------------------------------------------------------------------------+
  34. | :ref:`bool<class_bool>` | :ref:`is_on_screen<class_VisibilityNotifier_method_is_on_screen>` **(** **)** |const| |
  35. +-------------------------+---------------------------------------------------------------------------------------+
  36. .. rst-class:: classref-section-separator
  37. ----
  38. .. rst-class:: classref-descriptions-group
  39. Signals
  40. -------
  41. .. _class_VisibilityNotifier_signal_camera_entered:
  42. .. rst-class:: classref-signal
  43. **camera_entered** **(** :ref:`Camera<class_Camera>` camera **)**
  44. Emitted when the VisibilityNotifier enters a :ref:`Camera<class_Camera>`'s view.
  45. .. rst-class:: classref-item-separator
  46. ----
  47. .. _class_VisibilityNotifier_signal_camera_exited:
  48. .. rst-class:: classref-signal
  49. **camera_exited** **(** :ref:`Camera<class_Camera>` camera **)**
  50. Emitted when the VisibilityNotifier exits a :ref:`Camera<class_Camera>`'s view.
  51. .. rst-class:: classref-item-separator
  52. ----
  53. .. _class_VisibilityNotifier_signal_screen_entered:
  54. .. rst-class:: classref-signal
  55. **screen_entered** **(** **)**
  56. Emitted when the VisibilityNotifier enters the screen.
  57. .. rst-class:: classref-item-separator
  58. ----
  59. .. _class_VisibilityNotifier_signal_screen_exited:
  60. .. rst-class:: classref-signal
  61. **screen_exited** **(** **)**
  62. Emitted when the VisibilityNotifier exits the screen.
  63. .. rst-class:: classref-section-separator
  64. ----
  65. .. rst-class:: classref-descriptions-group
  66. Property Descriptions
  67. ---------------------
  68. .. _class_VisibilityNotifier_property_aabb:
  69. .. rst-class:: classref-property
  70. :ref:`AABB<class_AABB>` **aabb** = ``AABB( -1, -1, -1, 2, 2, 2 )``
  71. .. rst-class:: classref-property-setget
  72. - void **set_aabb** **(** :ref:`AABB<class_AABB>` value **)**
  73. - :ref:`AABB<class_AABB>` **get_aabb** **(** **)**
  74. The VisibilityNotifier's bounding box.
  75. .. rst-class:: classref-item-separator
  76. ----
  77. .. _class_VisibilityNotifier_property_max_distance:
  78. .. rst-class:: classref-property
  79. :ref:`float<class_float>` **max_distance** = ``0.0``
  80. .. rst-class:: classref-property-setget
  81. - void **set_max_distance** **(** :ref:`float<class_float>` value **)**
  82. - :ref:`float<class_float>` **get_max_distance** **(** **)**
  83. In addition to checking whether a node is on screen or within a :ref:`Camera<class_Camera>`'s view, VisibilityNotifier can also optionally check whether a node is within a specified maximum distance when using a :ref:`Camera<class_Camera>` with perspective projection. This is useful for throttling the performance requirements of nodes that are far away.
  84. \ **Note:** This feature will be disabled if set to 0.0.
  85. .. rst-class:: classref-section-separator
  86. ----
  87. .. rst-class:: classref-descriptions-group
  88. Method Descriptions
  89. -------------------
  90. .. _class_VisibilityNotifier_method_is_on_screen:
  91. .. rst-class:: classref-method
  92. :ref:`bool<class_bool>` **is_on_screen** **(** **)** |const|
  93. If ``true``, the bounding box is on the screen.
  94. \ **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.
  95. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  96. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  97. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  98. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`