- Home /
Platformer2D Player sticks to platform corners
I am trying to create 2D platformer using Unity Physics2D, and I have this weird issue that occurs when the player jumps and in the air bumps along the wall. Instead of falling back down, he sticks to the edge, even though the player is clearly next to the platform as seen on the following picture.
I have observed the issue also when moving carefully to the edge, I can reach the same point. The raycasts that I am using to detect ground below don't detect any block, yet the player still doesn't fall down and stays in midair.
The player has Box Collider 2D and Rigidbody 2D (Dynamic) and the ground block has Box Collider 2D. I have added Physics Material with 0 friction to all of them but it didn't help at all.
Do you have any idea what causes this and how to resolve this? Is it an issue with Unity Physics? Is it even a good idea to use Unity Physics for 2D platformer or should I use only the collision detection and use my own physics controls?
Any insight is appreciated!
EDIT/UPDATE: After opening the project today in Unity, the problem with jumping along platforms is gone, so probably restarting Unity was a solution. However, it is still possible to get to the same position by movement along the platform. When the player jumps in this position he correctly drops all the way below the platform, but when he doesn't the block just levitates. Can this behavior be solved?
The collider could be of bigger size than the actual object?
Unfortunately, the colliders of both objects are identical with their mesh, I have even tried making it smaller for the player but it didn't change anything. It might have something to do with the Rigidbody2D physics behavior, what do you think?