How can pivot point of a mesh be changed inside unity?
There was two solution provided inside the forum.
1.To change it inside the multimedia tool.
2.To create a new gameobject and place the mesh inside it.
The second solution suggested vary according to scenario.It is not feasible for all the cases.
Doesn’t unity provide an API to change it?
Why does the second solution does not work for all cases or is there certain things needed to be taken care off before placing the mesh inside the new gameobject.
The only way I know of to change the pivot point is to create a new GameObject at the point you want the pivot to be, and then make your mesh a child of the new GameObject. If you built your mesh at the origin in a modeling program, you can’t, for example, move that pivot point down by one unit during gameplay. You’d have to do that in the modeling program.
Another possible solution is to “fake” the pivot point of your model by using offsets. We did this in a recent game where all of our meshes had their pivot points at their feet, but we occasionally wanted to position/rotate them based on their center points.
For positioning, when creating the object, record the difference between the actual pivot point and the desired pivot point in a vector. Then, when you calculate a position, you can add/subtract the difference vector to get the actual mesh position from the desired “fake” position. For rotation, you can use the transform.RotateAround function to rotate your mesh around a given pivot point. The only thing I’m not sure about is scale.