AI prompts
base on Optimizes mesh and polygon colliders in Unity # Unity Collider Optimizer
This package is meant for:
- `MeshCollider` optimization (3D) via bundled gltfpack binaries
|  |  |  |
|:---:|:---:|:---:|
| Original Mesh | Unity Mesh Collider | Optimized Mesh Collider |
|**Tris, Verts Count**| *3032 tris, 2512 verts* | *918 tris, 592 verts* |
- `PolygonCollider2D` optimization (2D) using RDP line simplification
|  |  |  |
|:---:|:---:|:---:|
| Original Sprite | Unity Polygon Collider | Optimized Polygon Collider |
|**Path Count**| *214 paths* | *23 paths* |
## Requirements
- Unity 2020.2 or newer recommended
(for `MeshColliderCookingOptions`)
- A glTF/GLB importer package in your project:
- `com.unity.cloud.gltfast` (glTFast) or
- `com.unity.formats.glTF` (UnityGLTF)
- Supported OS for the included gltfpack binaries:
- Windows
- macOS (Intel & Apple Silicon)
- Linux
> [!NOTE]
> If you don’t have a GLB importer, the tool can’t re-import the simplified mesh and will log an error telling you to install one
## Usage
#### Install
- Download the `collider-opt-pkg-v005.unitypackage` package from the [Releases](https://github.com/aniketrajnish/Unity-Collider-Optimizer/releases/tag/005) section and import in your Unity project
- Follow the prompt to install the glTF/GLB importer
- (macOS/Linux) If the `gltfpack` binary isn’t executable, the tool will attempt to `chmod +x` automatically
#### Optimize Colliders
- Select a GameObject with a `MeshCollider` (3D) or `PolygonCollider2D` (2D)
- Open context menu by right clicking the component header -> `Optimize Collider`
- If needed you have option to Load/Save/Reset Collider aswell
#### Adjust Params
- To adjust params for the optimizer go to `Tools -> Collider Optimizer`
- **Mesh Optimization Params**:
- `Contraction` : higher contraction -> fewer triangles kept
- `Recalc Normals` : recalculate normals after import
- `Convex` : sets `MeshCollider.convex = true` (Unity may auto-reduce to ≤255 tris)
- `Aggressive (-sa)` : simplifies aggressively (more tris reduced)
- `Permissive (-sp)` : simplifies permissively (less tris reduced)
- **Polygon Optimization Params**:
- `Tolerance` : maximum perpendicular distance new path is allowed to deviate from the original path (higher tolerance -> fewer lines kept)
- `Tolerance Mode` :
- `World` : interpreted in world units
- `Relative` : interpreted as fraction of per-path bbox diagonal
- `Scale By Bounds` : In `World` mode, multiply tolerance by each path’s bounds diagonal (useful for differently sized shapes)
#### Presets
- You get the option to define presets for different param sets you'd like to save
- Create presets via `Assets -> Create -> ColliderOptimizer -> Mesh Preset or Poly Preset`
- In `Tools -> Collider Optimizer` window assign these presets to make them active
- Without an active preset the settings are stored in `Project Settings` at `ProjectSettings/ColliderOptimizerSettings.asset`
- `Reset to Defaults` will update the preset (if assigned) or the project settings to the default values
https://github.com/user-attachments/assets/9530f417-eb80-4108-ab7c-36454a7a409c
## Performance Comparison
https://github.com/aniketrajnish/Unity-Collider-Optimizer/assets/58925008/e134f0c6-4c08-4552-b69f-22e7f3b61ebe
https://github.com/aniketrajnish/Unity-Collider-Optimizer/assets/58925008/cfba7837-a81e-4891-9594-501fbf31680f
## Gotchas
- For skinned meshes, the tool bakes a static combined mesh for collider usage (as intended for physics), not skinning, anyways I won't use a `MeshCollider` for a skinned mesh
- Extremely degenerate or non-triangular topologies are skipped
- `glb import produced no loadable assets` <br>
Install/reinstall a GLB importer package (UnityGLTF or glTFast) & reoptimize
- Unity limits convex colliders to ≤255 tris, it may auto-simplify further
- If you see warnings about very large triangles (>500 units), check your model scale. The tool bakes transforms, but mismatched import scales can still yield oversized geometry
- The tool attempts to `chmod +x` the `gltfpack` binary, if gatekeeper still blocks it, allow it in System Settings or remove quarantine attributes manually
## Contribution
Contributions to the project are welcome, consider making a PR
## License
MIT License
", Assign "at most 3 tags" to the expected json: {"id":"3238","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"