I'm trying to pull off a level wrap using cameras and viewports.

The good news, Visually, it works. From a player perspective, you don't notice the transition.
I'm using the same trick to pull off a compass that is in sync with the level.

It's my understanding, however that i can't, say, have a button within one of those camera views and expect to click on it through one of these sub viewport copies. I saw something about it being to do with some difference in World_2D and World_3D. But I cannot find it again.

For now, I can just replicate buttons and enemies at the other viewport coords.

Can anyone shed some light on this? I'm not opposed to taking a shot at modifying the engine source code to pull this off the way i want, or at least make an attempt.. I'm just not sure what my starting point is, here.

Any insights would be greatly appreciated.

    xyz

    The intent is to be able to use cameras and viewports to replicate the ends of a level in their entirety. INCLUDING any buttons, enemies, etc.

    So that IF a user interactable is within the viewport space, it acts as if it's in the level and mouse input events just work.

    Locator node has a camera attached. That camera slides across everything else and warps back to the other side.

    Level is 1280px, sub viewports are 320px on either end.

    Camera set positions are 1440px to 160px
    And 160px to 1440px. I don't have the info right in front of me, but I'm pretty sure that's what the offsets are.

    To give you an idea, turn yourself around 360 degrees. Now apply that idea to a 2D image, without actually duplicating any nodes.

    • xyz replied to this.

      It's more, I want to be able to affect the real buttons, enemies, whatever happens to be there, through the subviewport.

      I expected that when I shared world_2d, between subviewports, that anything shown in that conatiner at runtime would be real time affectable by the user....because it would simply be a camera view or portal if you will, to the other side of the level.

      inputs, however, don't go through, it seems.

      See what I'm getting at?

        bhampton7752 I deleted my last post because it's still not actually doing what I want. I've been able to tighten up my camera warping offsets and adjust the map layout so there's only 160 px that I actually need to avoid putting things in.

        • xyz replied to this.

          bhampton7752 Not sure why you need 3 viewports. Wouldn't only 2 be sufficient?

          You can intercept gui input events in some full-screen control node's _gui_input() handler. This control should be placed outside of subviewports and on top of their containers and its mouse mode set to Stop. When an event is received, forward it manually to the viewport that contains buttons using Viewport::push_input(). Before forwarding, check if the input event has position property. If yes, forward the event twice and in the second forward offset event's position property by the difference between camera positions.

          6 months later

          How did you set this up?
          I can't get the SubViewport to "see" anything that is not a child of it. I thought having a Camera2D inside the SubViewport would be able to fix this, but it doesn't work.