• Stars
    star
    370
  • Rank 114,855 (Top 3 %)
  • Language
    C#
  • License
    MIT License
  • Created almost 1 year ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Optimizes mesh and polygon colliders in Unity

Unity Collider Optimizer

Optimizes Mesh & Polygon colliders in Unity.

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

More Repositories

1

MultiWindowSync-PyQt

Windows GUI multiple window synchronization using pyqtSignal
Python
334
star
2

Text-To-Material-Unity

Generate materials from text prompts in Unity
C#
70
star
3

Raymarching-Engine-Unity

A raymarching engine for Unity
C#
45
star
4

SpiderVersePostProcess-Unreal-Unity

Spiderverse-insprired stylized post processing-effect for Unreal Engine and Unity
ShaderLab
31
star
5

4D-Engine-Unity

A 4D Raymarching Engine for Unity
C#
22
star
6

3D-Shapes-Dataset-Generator

Helps procedurally generate tailored 3D shape datasets
ShaderLab
16
star
7

swerve-controller-unity

another generic swerve controller I wrote for Unity
C#
9
star
8

MeshToPointClouds-Houdini

A pyhton shelf tool to convert mesh to point clouds using Houdini
Python
7
star
9

Alembic-to-FBX-File-Maya

A python script that converts an Alembic file to animated FBX files using Maya.
Python
7
star
10

non-euclidean-stencil-shader

Non Euclidian stencil shader with a demo scene for Unity!
ShaderLab
6
star
11

2d-lighting-system-unity

2D lighting in Unity
C#
6
star
12

jelly-physics

Jelly Physics simulation in Unity!
C#
5
star
13

TrippyPostProcessing-Unity

A trippy post processing and render feature for Unity's URP
Mathematica
5
star
14

optimized-2d-lighting-unity

2d lighting, but optimized using mesh generation!
C#
4
star
15

specular-lighting-opengl

Specular Lighting in OpenGL
C
4
star
16

time-scale-independent-controller

A time scale independent controller for cool bullet time effects!
C#
4
star
17

CS499-SDFNet

ASP.NET
3
star
18

superhot

Recreate superhot in 30 lines of code!
C#
3
star
19

4D-tesseract-unity-implementation

4D hypercube in Unity!
ShaderLab
2
star
20

Triangle-Calculator-PyQt

A triangle calculator built using PyQt
Python
2
star
21

obamium-maker

Make your own version of Obamium
C#
1
star
22

PBR-Maps-Generator

[WIP] Helps generate PBR maps from a base/diffuse map depending on the workflow chosen.
C#
1
star
23

UE5-Stuff

Some stuff I made in UE5
1
star
24

Houdini-Python-Practice

python scripting practice in houdini
Python
1
star
25

Maya-Auto-Rigger-PySide2

A WIP Auto Rigger for Maya built using PySide2/PyQt5
Python
1
star
26

Gamejam-2023-AD-game

C#
1
star
27

Model-Showcase-Tool-Maya

A tool that creates a camera animation around your model to display it professionally.
Python
1
star
28

get-all-children-of-a-gameobject

Get all the children of a gamobject!
C#
1
star
29

Hypercasual-Prototype

C#
1
star
30

operagx-gamejam-speedrun

speedruning a gamejam with my boi shaydiesin
Yacc
1
star