How to have different locations displayed on screen at the same time in 2D?

2D game. Camera on player character.

I want to display other locations on screen while my camera still on player. Like having security camera watching other locations of my game, and output to a control node on screen. When the player is near the watched location, the player should be seen on those security camera.

How should I do it?

I tried using SubViewport with camera output as texture rendered to a sprite. But that forces me to put scene as child node of the SubViewport, which removes it from the primary viewport.

you have to replicate your current scene inside the subviewport to have something like a camera

Ok, after searching for a bit, I find the easy solution: just set the world_2d attribute of the SubViewport to your primary viewport’s world_2d should work. Which means simply adding the following script to your top node:

func _ready():
	$Path_to_your_SubViewport/SubViewport.world_2d = get_viewport().world_2d

There is currently no editor option on SubViewport for this, so it has to be done by code.

1 Like