Collisions between objects of different layers

I’m a bit confused because I’m getting used to moving the camera.

I have noticed that if an object on a layer that is moved by the camera collides with another object on a layer that is not moved by the camera, the collision does not work.

Example: Let’s say it’s a side-scrolling platform game and there is no scroll to go back and there is a wall marking the left edge of the screen. I put that wall on a layer that doesn’t move the camera, this way even if i move the character then the wall always stays on the edge. That wall works as long as I don’t move to the right, but if I move to the right and then go back and collide with that wall, the collision doesn’t work even though visually there is a collision.

I can manage this situation by making a wall that moves but I want to understand if this is the expected result

Each layer has a unique camera. However, all x/y positions are absolute.

It doesn’t matter if the objects on different layers are touching visually if their actual x/y positions are different, they won’t actually collide.

Inversely, if the cameras are moved, it doesn’t matter if the objects aren’t colliding visually if their actual x/y coordinates are touching. They will still collide.


Ok, thanks for the explanation

1 Like