#Displaying Camera2D output into a Subviewport

1 messages · Page 1 of 1 (latest)

quasi quail
#

Hi, I am making a camera-based game (think pkmon snap). I have one main camera2D pointing at the entire viewport, and on a buttonpress, the active camera switches to another Camera2D that is zoomed in (to simulate the player's camera scenefinder (zoomed in). This 2nd camera can be panned using arrow keys.

I currently have it working by displaying both Camera2D to the main Viewport. But I want to change it such that I can display the zoomed in camera in a subviewport. How can i go about doing it.
Imagine that the zoomed in version is to be displayed within the bounds of a "Camera" sprite, in the centre of the main viewport

wanton canyon
#

This will be a little difficult with 2d, as viewports will only render what is a direct child of them.

#

Is there any disadvantage to you simply using a single viewport, and changing which camera is active?

quasi quail
#

hi nitric! yea i realised from researching on how to do this that its easier with 3d

quasi quail
#

i just wanted to give it a visual polish by allowing it to appear within a "camera sprite" frame

wanton canyon
quasi quail
#

Hey no problem man. Appreciate you dropping in. I slapped on a canvas layer w a hint of a camera viewfinder that shows up w the zoomed in mode and called it a day.