Continuous camera looping

Hi. I’m trying to implement the following mechanism. The camera should loop along the x axis, seeing both sides of the in- game world at the same time. Any suggestion so as to what methods I should use ?


There are certainly many alternative solutions, but I’ve only come across costly ones : (1) setting a circular world, with the camera rotating around the center instead of moving along the x axis, (2) creating a parallel world with the camera popping up the other side once it reached a certain coordinate.

I think the best way to do this is to use two cameras. Your first camera is your main camera and it moves around as necessary. There will be another second camera that is layered behind the first one that will render the remaining scene that the first camera is missing. The hard part is finding out where to place the second camera. The way you do this is you constantly calculate how close the first camera’s position relative to the edge of the screen. You also need to calculate the size of the screen which would need to be in the formula somewhere. Once you figure out where the second camera should be, update its position. In my opinion that’s the most optimized way to do it.

Another way you could do it would be to duplicate the whole scene when you get close to the edge and just tile the beginning of it to the end of the first tile but that could be problematic depending on what kinda game you’re making and not a clean solution.

@Harinezumi I’ve finally mplemented the complementary method and it works very well without boundary at 60fps, using only :

Hello, i’m stuck at the problem too, can you explain more about how you achieved it