Circle Collider Stuck to Box Collider
Hello, everyone!
I'm working on a 2D game in Unity that's very similar to Soccer Stars. I've found that my object gets stuck to the wall a lot. Even if another object comes and collides with it, it moves but along the wall. See this video for a better understanding of what I mean.
The walls in my case have 0 friction (and box colliders) and the ball has a friction of 0.2 (and circle collider). Both have a bounciness of 1. I'm trying to use the Unity physics system so there's nothing in my code effecting the physics at all. I've tried numerous solutions and followed many answers but nothing seems to work. Even tried turning the wall to an edge collider but to no avail.
Thanks in advance for your help!
I have the same issue. What version of unity are you using? I thought about upgrading to latest version to see if it solved it.
I found the solution! I've posted it as an answer here so you can see it. Let me know if it helps!
Answer by thenash654 · May 02, 2019 at 05:27 PM
I finally fixed it. What did the trick for me was lowering the velocity threshold in Project Settings > Physics2D. This threshold is used by Unity to bounce objects off of other objects.
I also added a script to my objects just to make sure they don't get stuck again. The script uses OnColliderStay to check if an object is stuck to the border. Then, it moves the object just a bit (depending on which side of the border it's stuck to) in order to make it 'unstick' and not collide anymore. This is just a fail safe since I got so paranoid. The velocity threshold is definitely what did the trick.