What's the best way to handle a Rigidbody 2D on a Circle Collider 2D trying to fall through a too-small gap?
My player character is a circle with a Circle Collider 2D and a Rigidbody 2D. For the most part, the rigidbody physics work well for my game. I've written my own code to handle gravity, acceleration, drag, etc. to get a very specific feel, but I'm letting unity handle collisions and now I'm running into an issue.
When there is a gap the player can't fit through, as seen here: The player is always moving just a tiny bit with gravity trying to pull it down and forward. It's causing my floor sliding sound effect to always be triggering.
I was thinking of detecting collisions that are off-center with the bottom half of the circle collider, collisions that would push the character forward or backward with gravity, and then detecting if there is a wall preventing that and snap velocity to 0.
Is this already a solved problem though? What would be the best way to handle this?
Your answer
![](https://koobas.hobune.stream/wayback/20220612174630im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
My movement is not smooth 0 Answers
Animation and CharacterController in Unity3D 1 Answer
How do I get my Player to change lanes over time rather than teleport? 0 Answers
Making a crouch button for a rigidbody character controller without scaling item in hand 0 Answers
Can't get my character controller to jump properly (3d) 1 Answer