VisibilityNotifier2D.xml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="VisibilityNotifier2D" inherits="Node2D" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
  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. <description>
  18. If [code]true[/code], the bounding rectangle is on the screen.
  19. [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.
  20. </description>
  21. </method>
  22. </methods>
  23. <members>
  24. <member name="rect" type="Rect2" setter="set_rect" getter="get_rect" default="Rect2( -10, -10, 20, 20 )">
  25. The VisibilityNotifier2D's bounding rectangle.
  26. </member>
  27. </members>
  28. <signals>
  29. <signal name="screen_entered">
  30. <description>
  31. Emitted when the VisibilityNotifier2D enters the screen.
  32. </description>
  33. </signal>
  34. <signal name="screen_exited">
  35. <description>
  36. Emitted when the VisibilityNotifier2D exits the screen.
  37. </description>
  38. </signal>
  39. <signal name="viewport_entered">
  40. <argument index="0" name="viewport" type="Viewport" />
  41. <description>
  42. Emitted when the VisibilityNotifier2D enters a [Viewport]'s view.
  43. </description>
  44. </signal>
  45. <signal name="viewport_exited">
  46. <argument index="0" name="viewport" type="Viewport" />
  47. <description>
  48. Emitted when the VisibilityNotifier2D exits a [Viewport]'s view.
  49. </description>
  50. </signal>
  51. </signals>
  52. <constants>
  53. </constants>
  54. </class>