Masking a portion of your scene and revealing it in a selected area in 2D

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

For one of my games I want to add in a real-time mirror, and decided to take a Metal Gear Solid approach and have it so a duplicate character walks around behind a hidden layer with inverted y axis controls, and an object acts as a mask that shows whats behind the hidden layer, and the duplicate player giving off the illusion of reflection, but I’m not sure how to make this work. How would I?

:bust_in_silhouette: Reply From: JimArtificer

Have you considered using a Viewport?

They seem designed to perform the function you want. You can even give them an optional world that they draw that isn’t shared with other viewports. (Though in the case of a mirror I think you could use one to render to a target texture instead of using a rendering technique from the Playstation era.)