Move the origin to the center of the object

Haven’t found a general method to move the origin to the center of the object, and I need everyone’s help (1.4 MB)

You can use mesh.setPivotPoint(), see:

The other solution is to create a new parent that will act as a pivot. After having center the object from the bounding box hierarchy.
Overall, the topic has been discussed a number of times.
Here are a few links that might be of interest to you:

1 Like

I think your plan is very good, but my model is to process the last-level nodes in multi-layer nodes. When processing according to the plan provided by you, it will deal with the situation where the model deviates far away. It is best to publish a more official document. Comprehensive case.

You can move the mesh to and bake the current transformation to the vertices:

1 Like

Cool. I’ve been trying this with a number of meshes I got from sketchfab.
Though from the PG link above it didn’t work. I guess because the node is (may be) in fact the root.
So I made an attempt here to translate this (better said, ‘combine this’) with the base I had implemented using ‘getHierarchyBoundingVectors(true)’.
Here’s the PG that lets you load any mesh. I found it working but I do have question for you:
" Is any of this not necessary or even inappropriate? "

I’m not sure what you mean, if you want to center based on the entire mesh hierarchy, then using getHierarchyBoundingVectors() seems appropriate.

I mean nothing in particular. I did multiple tests and I believe it works. I guess I just wanted to make sure that this is somehow ‘recommendable’.