In my case, the eventual goal will be a display monitor in one that can be brought to fullscreen, showing the other world entirely. The exact presentation is flexible.
I have not fully set this up yet, but my preliminary setup for actually displaying the viewports is as follows (note that I am working with my own build of godot 4.x because I am impatient and live dangerously ? so the gdscript syntax is the bleeding edge flavor, but the principles should be the same)
extends Node2D
@export var viewport_path: NodePath
@onready var _viewport_sprite := $ViewportSprite as Sprite2D
@onready var _viewport := get_node(viewport_path) as SubViewport
func _process(_delta):
var win_size := DisplayServer.window_get_size()
if _viewport.size != win_size:
_viewport.size = win_size
_viewport_sprite.texture = _viewport.get_texture()
I have absolutely no idea if this is a good way to do it. Hence this thread, I guess! The intent is to have one of these for each viewport and toggle visibility and whatnot as needed.
Beyond that I'm also trying to figure out how to properly use the World resource. It doesn't have as many properties as I'd expect, or maybe does it "just work"? This is unfamiliar territory for me, so I am a bit timid about it.