- Home /
2D Geometry Dash Clone Player Stuck Between Tiles
I was playing Geometry Dash one day and thought, "Hey, this should be easy to make in Unity!" so I got to work. After a good bit of work, I have something playable going, but I have noticed that my player can sometimes get stuck between two tiles that make a flat surface. (Yes, I am using the slippery physics material but it still gets caught.) I tried changing the BoxCollider2D to a CircleCollider2D, and it fixed that problem, but sometimes the CircleCollider2D would slow down slightly when it landed from a jump, even though I put the slippery material into the new collider.
I need it to not get caught between tiles with a box collider, or I need it to keep its horizontal velocity on a flat surface or when hitting the ground after a jump with a circle collider.
What should I do to fix this? Is this possibly a glitch in Unity that cannot be avoided (If so, what kind of workarounds can I use?)?
Answer by MelvMay · Apr 13, 2016 at 07:29 AM
This is just an artifact of how Box2D works and TBH how most physics engines work. It calculates collisions for each collider separately. A good write-up of it can be found here.
The EdgeCollider2D is designed to resolve this problem by allowing you to create a continuous surface of edges which won't have this problem. That is also much more efficient than adding lots of box colliders.
Finally, I'm working on a CompositeCollider2D in Unity that allows blending of multiple collider shapes which will also stop this issue. You can see more info on this on my Twitter feed.
https://twitter.com/melvmay/status/715165831680884736
Your answer
Follow this Question
Related Questions
Collider just for Tag (2D) (C#) 1 Answer
Problem with disabled collision in 2D objects 0 Answers
How to check if my enemy hits the ground at a certain velocity then add explosive force. 1 Answer
How to check if an object hits the ground hard enough then add explosive force around it (2D) 1 Answer
Jumping from special jump orb 1 Answer