Hi! I’m trying to learn 2D collisions and I’ve a little problem.
I’ve set the collision on my player only on his body (not the head), so if I go behind a tree everything work fine but if I go from bottom to top this happens (second image). There is a way to resolve this problem?
You’re talking about collisions, even in the title which suggests your problem is with collisions but then you seem to be indicating it’s with rendering and sorting order. Which is it?
You are running into the same problem as I am at the moment. Its fine when ur behind because the player is behind the tree in ur sorting layers. But when ur in front ur player is STILL behind the tree in the sorting layer, so your player will be rendered behind.
What you want is basically an illusion of 3d in 2d, i.e a z-axis. So that it looks like you are “in front” of the tree. I have no idea how to do this, but at least I can tell you what is wrong. Hopefully someone else can give you (us) an answer
Hello, I don’t know if you might find this useful. But for trees, I’ll split mine in half. So the top half would be on a higher layer, while the bottom half on lower layer (than the player). Then you can set the collider on the tree so that it lines up just so the player can switch between the front and back of the tree while keeping up appearances