Class VisibleOnScreenNotifier2D
A rectangular region of 2D space that detects whether it is visible on screen.
- Inheritance
-
VisibleOnScreenNotifier2D
- Derived
Remarks
VisibleOnScreenNotifier2D represents a rectangular region of 2D space. When any part of this region becomes visible on screen or in a viewport, it will emit a screen_entered signal, and likewise it will emit a screen_exited signal when no part of it remains visible.
If you want a node to be enabled automatically when this region is visible on screen, use VisibleOnScreenEnabler2D.
Note: VisibleOnScreenNotifier2D uses the render culling code to determine whether it's visible on screen, so it won't function unless visible is set to true
.
See Also
Properties
rect
The VisibleOnScreenNotifier2D's bounding rectangle.
var rect : Rect2 = Rect2(-10, -10, 20, 20)
Property Value
Remarks
Methods
is_on_screen
Qualifiers: const
If true
, the bounding rectangle is on the screen.
Note: It takes one frame for the VisibleOnScreenNotifier2D's visibility to be determined once added to the scene tree, so this method will always return false
right after it is instantiated, before the draw pass.
bool is_on_screen
Events
screen_entered
Emitted when the VisibleOnScreenNotifier2D enters the screen.
signal screen_entered
screen_exited
Emitted when the VisibleOnScreenNotifier2D exits the screen.
signal screen_exited