How to make a node behave differently in different viewports?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ArAdev

Hello, I want to know if there is s a way to make a node have a different behavior depending on what view-port it`s localized.
The thing is that I have two view ports, one for player 1 and another for player 2. I have a sprite that shows when a player is close to a interactive object and hide when the players are far, but when it shows, it can be seen in the two view ports. Is there a way to make it so that when the interactive object shows, it only do it in the corresponding player´s view port?

Maybe this is an older question, but i actually still have the same question.

The only way i can think of a solution is to make level twice, and where one is for player one, and the second one for player two. This would then work by sharing some variables with a singleton object. As in sharing a kind of save state for the second screen and making the objects that are to far away for player two nonvisible in the second level for player two. In my opinion very convoluted, and not really nice if you just try to solve an issue like fog of war for each player.

I just wish there was something that could dictate; don’t show this object for this viewport if… Maybe in godot 5.

JohnnyFrost | 2023-05-20 19:10