yasirkula / UnityAdjustPivot

Adjust pivot point of an object in Unity without creating an empty parent object
BSD Zero Clause License
151 stars 17 forks source link

Pivot Editor for Unity

screenshot

Available on Asset Store: https://assetstore.unity.com/packages/tools/utilities/adjust-pivot-112883

Forum Thread: https://forum.unity.com/threads/adjust-pivot-without-using-an-empty-parent-object-open-source.520178/

Discord: https://discord.gg/UJJt549AaV

GitHub Sponsors ☕

This script allows you to change the pivot point of an object without having to create an empty GameObject as the pivot point. There are two types of pivot adjustments:

a. If the object does not have a mesh (MeshFilter, to be precise), then the script simply changes the positions and rotations of child objects accordingly

b. If the object does have a mesh, then the script first creates an instance of the mesh, adjusts the mesh's pivot point by altering its vertices, normals and tangents, and finally changes the positions and rotations of child objects accordingly

Not tested with SkinnedMeshRenderer.

INSTALLATION

There are 5 ways to install this plugin:

HOW TO

Open the Adjust Pivot window via the Window-Adjust Pivot menu.

To change an object's pivot point, you can create an empty child GameObject and move it to the desired pivot position. Then, you can press the Move X's pivot here button to move the parent object's pivot there. It is safe to delete the empty child object afterwards.

Note that if the object has a mesh (option b), to apply the changes to the prefab, you have to save the instantiated mesh to your project. Otherwise, the asset will be serialized in the scene and won't be available to the prefab. You have two options there:

Afterwards, you can safely apply your changes to the prefab.

There are a few options that may be helpful in certain circumstances: