Imagine Mario bros, when he jumps from the ground to the upper block platform. He jumps through it, but then, he lands on it. That’s what I need.
Both of my elements (the character and the platform) have a BoxCollider2D attached, so when I try to jump from bellow, the character just hits the platform.
How can I achieve that?
If you’re using Unity 5 then you can use the PlatformEffector2D component which provides the ability of one-way collisions.
You can check if your character is under platform when it’s jumping. If yes, disable the platform collider.
Im using Unity 4.6, so I deactivated the collider when Im below the platform until I get above. Not the most elegant solution but it worked.