[SOLVED] Camera and Layer Problem

My game has a lot of layers because some objects really need to be on top of other and it looks like this:

I’m using the event where the camera will follow the Angel smoothly by using lerp like this:

The problem is when I put other objects to the base layer, (Angel is also in the base layer) they also slowly moves when I move the Angel. I can’t make another layer to separate those objects to the Angel because I will use the Y-Sort there because my base layer will be the layer that the player, enemies, items will be in and they must have Y-Sort. In short, I just want to make the camera follows the Angel even if there’s a lot of layers and other layers mustn’t be affected by it.

Rather than lerping all the cameras, just do the one for the default layer and set the others layers to that :


1 Like

It kinda works but I see now the problem. I tested it out and the problem is this:

This makes other objects move slightly when I move the Angel. How can I fix that without separating other objects in the base layer?

You mean it makes them move when the camera gets to the boundaries? Then stick the Enforce camera boundaries action immediately after the camera lerp, and before setting the camera on the other layers, like this :


It works! Thanks you so much.

By only lerping the default layer and set the other layer camera to it will it improve performace?

Not sure, and if it did, it’d probably be negligible. But it avoids any position discrepancies that could occur for whatever reason.