Is it possible to make VisibleOnScreenNotifier2D ignore my debug camera?

Godot Version

4.3

Question

I created a debug window for my game that shows a zoomed-out view of the game. I’m using a VisibleOnScreenNotifier2D to lock the camera whenever the player gets to a boss room. However, whenever the debug window is pulled up, the the notifier gets activated early, which leads to some wonky behavior. Is there any way to make it so that the notifier’s signal only gets activated with the main window?

I have videos showing this for better understanding, but it won’t let me upload them. Sorry.

No you cannot make it ignore a camera.

What you might be able to do is when the notifier fires, first check if the position of the object is in the viewport rect of the camera you want to have it fire for, and if not ignore it.

Or you could perhaps attach an area2d with a collision layer to the camera port you want to fire, and use area_entered rather than the notifier.

Both seem a lot of hassle though, especially when you start taking zooming into account.

Good luck with it. Would you post how you solved it when or if you do? Would be interested to hear what approach you took.

Hmm… I think that I’ll ditch the VisibleOnScreenNotifier entirely and just check the camera’s position directly. There’s a single camera for the game that’s accessible globally. It might be a hacky solution, but it’ll definitely fix the issue.

1 Like