VisibilityNotifier2D.xml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="VisibilityNotifier2D" inherits="Node2D" version="3.4">
  3. <brief_description>
  4. Detects approximately when the node is visible on screen.
  5. </brief_description>
  6. <description>
  7. 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.
  8. If you want nodes to be disabled automatically when they exit the screen, use [VisibilityEnabler2D] instead.
  9. [b]Note:[/b] For performance reasons, VisibilityNotifier2D uses an approximate heuristic with precision determined by [member ProjectSettings.world/2d/cell_size]. If you need precise visibility checking, use another method such as adding an [Area2D] node as a child of a [Camera2D] node.
  10. </description>
  11. <tutorials>
  12. <link title="2D Dodge The Creeps Demo">https://godotengine.org/asset-library/asset/515</link>
  13. </tutorials>
  14. <methods>
  15. <method name="is_on_screen" qualifiers="const">
  16. <return type="bool">
  17. </return>
  18. <description>
  19. If [code]true[/code], the bounding rectangle is on the screen.
  20. [b]Note:[/b] It takes one frame for the node's visibility to be assessed once added to the scene tree, so this method will return [code]false[/code] right after it is instantiated, even if it will be on screen in the draw pass.
  21. </description>
  22. </method>
  23. </methods>
  24. <members>
  25. <member name="rect" type="Rect2" setter="set_rect" getter="get_rect" default="Rect2( -10, -10, 20, 20 )">
  26. The VisibilityNotifier2D's bounding rectangle.
  27. </member>
  28. </members>
  29. <signals>
  30. <signal name="screen_entered">
  31. <description>
  32. Emitted when the VisibilityNotifier2D enters the screen.
  33. </description>
  34. </signal>
  35. <signal name="screen_exited">
  36. <description>
  37. Emitted when the VisibilityNotifier2D exits the screen.
  38. </description>
  39. </signal>
  40. <signal name="viewport_entered">
  41. <argument index="0" name="viewport" type="Viewport">
  42. </argument>
  43. <description>
  44. Emitted when the VisibilityNotifier2D enters a [Viewport]'s view.
  45. </description>
  46. </signal>
  47. <signal name="viewport_exited">
  48. <argument index="0" name="viewport" type="Viewport">
  49. </argument>
  50. <description>
  51. Emitted when the VisibilityNotifier2D exits a [Viewport]'s view.
  52. </description>
  53. </signal>
  54. </signals>
  55. <constants>
  56. </constants>
  57. </class>