[2D] How to Smooth out Rugged Ground

So I have very rugged terrain, but when the player runs along it, he bounces all over the place. How can I autogenerate the collider but have it be more smooth?

Example: Screen capture - 4435a06684f95c89d3b7a698e5c686eb - Gyazo

Any help would be greatly appreciated!


you could use a the Douglas Peucker algorithm. It basically looks at a drawn polygon/line (your mesh topmost vertices) and removes every “unnecessary” vertice in between.

You can use this by creating a new empty gameobject container, that overlays your current ground. Then you sample the topmost vertices from your ground, apply DP-Algo and create a new Mesh with theses reduced points. Add this mesh to your container go and add a mesh collider. Remove the collider from the original mesh and you should be good to go.