Giter VIP home page Giter VIP logo

unity-collider-optimizer's Introduction

Unity Collider Optimizer

Optimizes Mesh & Polygon colliders in Unity.

placeholder_uco

Polygon Collider Optimizer

PCO_V1 PCO_V2 PCO_V3
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.

Performance Comparison

Polygon.Collider.Comparision.mp4

You can run this test on your machine by cloning the project and going to the Polygon Collider Optimization Test scene in Unity.

Usage

  • Download the collideroptimizationpackage_2d_v004.unitypackage package from the Releases.
  • Import all the assets from the package in your unity project.
  • Attach the PolygonColliderOptimizer.cs script on your 2D sprite.
  • Adjust the optimizationFactor to control the amount of optimzation you need.
Polygon.Collider.Optimization.V02.mp4

Mesh Collider Optimizer

MCO_V1 MCO_V2 MCO_V3
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 Metrics simplification on the shared mesh of the mesh collider.

Performance Comparison

Mesh.Collider.Comparision.mp4

You can run this test on your machine by cloning the project and going to the Mesh Collider Optimization Test scene in Unity.

Usage

  • Download the collideroptimizationpackage_3d_v004.unitypackage package from the Releases.
  • Import all the assets from the package in your unity project.
  • Attach the MeshColliderOptimizer.cs script on your 2D sprite.
  • Choose the connecting mode between Fast, Precise, and No.
  • Adjust the optimizationFactor to control the amount of optimzation you need.
  • Choose the mesh style to be Soft, Hard or both.
  • Warning: Choosing the "Fast" mode would likely lead to errors, Precise mode is recommended for most of the meshes.
Mesh.Collider.Optimiztion.V02.mp4

Updates

v004

  • Added the functionality to save and load the optimized colliders as assets.
  • Fixed the refresh bug.
Save.Load.Data.mp4

Contribution

Contributions to the project are welcome. Currently working on converting the QEM algorithm to a coroutine to stop the main Unity thread from freezing.

Known Bugs

  • If a prefab is made out of a gameobject having Polygon Collider Optimizer, it keeps refreshing itself. [FIXED]
  • Choosing Hard Edge Mesh Style decreases the number of triangles but induces additional vertices (doesn't affect the performance).

License

MIT License

unity-collider-optimizer's People

Contributors

aniketrajnish avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unity-collider-optimizer's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.