Optimizes mesh and polygon colliders in Unity
Optimizes Mesh & Polygon colliders in Unity.
Original Sprite | Unity Polygon Collider | Optimized Polygon Collider |
Path Count | 213 paths | 23 paths |
The tool uses a C# implementation of the Ramer Douglas Peucker Algorithm to smooth the polylines and reduce the number of paths created by a Polygon Collider in Unity.
You can run this test on your machine by cloning the project and going to the Polygon Collider Optimization Test
scene in Unity.
collideroptimizationpackage_2d_v004.unitypackage
package from the Releases.PolygonColliderOptimizer.cs
script on your 2D sprite.optimizationFactor
to control the amount of optimzation you need.Original Mesh | Unity Mesh Collider | Optimized Mesh Collider |
Triangles Count | 9132 tris | 2416 tris |
The tool uses the Computational Geometry Unity Library by Erik Nordeus 🐐 to perfrom the Quadric Error Metric simplification on the shared mesh of the mesh collider.
You can run this test on your machine by cloning the project and going to the Mesh Collider Optimization Test
scene in Unity.
collideroptimizationpackage_3d_v004.unitypackage
package from the Releases.MeshColliderOptimizer.cs
script on your 2D sprite.optimizationFactor
to control the amount of optimzation you need.Contributions to the project are welcome. Currently working on converting the QEM algorithm to a couroutine to stop the main Unity thread from freezing.
MIT License