In an earlier Godot version there was apparently a split_screen_demo
under 2d in the demos folder, but that's no longer present.
I tried mimicking what I believe that was doing (having a viewport with the world in it, and an additional viewport for the second camera; the code there did this by calling viewport2.set_world_2d(viewport1.get_world_2d())
. I believe the equivalent in Godot 3 is viewport2.world_2d = viewport1.world_2d
.
However, when I do this, if I look at the results in the inspector I see that viewport2 gets a copy of the sprite that's under viewport. If I move the sprite under viewport, it doesn't update in viewport2's render target, and if I move the sprite under viewport2 it does, but then not under another view. This is the model I really don't want, a whole new copy of the world for each camera.
Is there a way to do it the way I want in Godot 3, rendering several windows onto the same world?