- Home /
How to check from which side a gameobject collide?
Hello!
I’m kinda new to Unity, started a few months ago and I’ve found a lot of solution and help here from You. I’m making a 2D platformer just for the experience and to learn a bit more on coding. I’m struggling with an issue since a few days and I hoped you could help me out or point out to some possible solutions. The issue is: I have horizontally moving platforms in the level and the problem is when I hit the side of a platform the Player stucks on it. I’m using 2D Box Colliders. One is on the platform itself and one on the Player. I tried to „seal” the sides of the platform with small Colliders but on those I can’t use my „isAirborn” and „canJump” bools because it will stuck like it stucks now without the „seals”. And when I’m standing on the platform and hit these „seals” the character will stop because „isAirborn” will be true (because the character is not colliding with a collider that is set to ground) and „canJump” will be false because „isAirborne” is true. Is there any simple way to determine from wich side I’m colliding with a collider? Tried to have two colliders on the player, one at the feet and the rest on her body but if I would hit the platform’s side with the feet collider it would stuck too. Thanks in advance!