# Slope polygon collider 2D causing box collider 2D to 'bump' while sliding on it

I'm doing procedural terrain generation. So far I've created the mesh, and attached a 2D polygon collider to it. The terrain is made up of hills going up and down.

After doing so, I put a 2D rigid body, along with a 2D box collider to represent the player. When I put the player on top and let him slide all the way down, sometimes he doesn't slide properly, and instead bumps on the hill, jumping all of a sudden on his own as if he tripped on something (even though there's nothing there). What's weird is that it doesn't happen all the time, just sometimes. Even when I make him slide on the same spot he bumped before again, he wouldn't do it again except on rare occasions.

What could be causing this?

• Is your FPS spiking? Have you checked your stats window. I doubt that you are doing anything behind the scenes that could cause it to rocket but the culprit seems to be the box collider, as it is attached to your player and controls most of his translations. Not everything is a cure-all in Unity so you might have to roll your own. – Grey Feb 4 '14 at 20:34
• Also consider drawing your box to see if it intersects with your terrain at any point in time, as it may be one of the unexpected behaviors causing your character to trip. – Grey Feb 4 '14 at 20:35
• No FPS spikes. As far as the box collider goes, shouldn't the physics stop it from intersecting with the other collider? – Pat Feb 5 '14 at 7:04
• I had a similar issue when I had a box collider traveling along a sloped 2d terrain. I changed my box collider to a circle collider and that seemed to stop it but my sprite didn't need rotate to match the slope... – Savlon Feb 18 '14 at 8:51
• Savlon, I managed to solve the issue by doing the same thing you did. I had to manually rotate the object to math the slope though. I'll write up how I did it in an answer when I have some time. – Pat Feb 18 '14 at 9:04

void OnCollisionEnter2D(Collision2D col)