Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/skybird233/uboundsfix
Fix the bounds of the Skinned Mesh Renderer.
https://github.com/skybird233/uboundsfix
unity unity-scripts
Last synced: 13 days ago
JSON representation
Fix the bounds of the Skinned Mesh Renderer.
- Host: GitHub
- URL: https://github.com/skybird233/uboundsfix
- Owner: SkyBird233
- Created: 2024-04-27T07:56:21.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-04-27T08:48:02.000Z (7 months ago)
- Last Synced: 2024-10-11T10:23:33.184Z (about 1 month ago)
- Topics: unity, unity-scripts
- Language: C#
- Homepage:
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# UBoundsFix
Fix the bounds of the Skinned Mesh Renderer.
## Description
Changing the `Root Bone` in the `Skinned Mesh Renderer` doesn't affect the `Bounds`, but the `Bounds` are relative to the `Root Bone`.
This script helps you maintain the (world) position of bounds when changing the `Root Bone`.## Usage
1. Put the `Scripts/UBoundsFix.cs` in the `Scripts` folder and the `Editor/UboundsFixEditor.cs` in the `Editor` folder.
2. Duplicate your GameObject to back it up.
3. Attach the `UBoundsFix` script to a GameObject (usually the parent of the Skinned Mesh Renderer, or select `Obj` manually). If everything works fine, you will see a list of Skinned Mesh Renderers in the Inspector (or you can assign them manually).
4. (Optional) Click the `Detect` button to detect Skinned Mesh Renderers and original root bones.
5. Assign new root bones. Note that the script won't change anything if the new root bone is the same as the original root bone.
6. Click `Fix`.## Why
It seems that the root bones are always the same bone from the imported model, so the bounds do not change with animations. As a result, when meshes are in the camera but bounds are not, Unity will not render them. I didn't find a way to keep the bounds while changing the root bone in the Editor, so I wrote this script.