How To Set Pivot To Mesh Center

The Doc Side:
The latest pivot in Babylon (v3.2+) is a pre-transformation pivot and behaves differently than in tools like 3DS Max and Maya as the object’s position will move if scale is applied prior to setting the pivot.

I can’t understand set a pivot would not change a mesh’s position!, I read the whole doc of pivot in Babylon.js again and angin, but finaly I am still confused.

I just want to set a mesh’s pivot to its center, but I cant find any way to do it with babylonjs. In 3dsMax, only I need to do just align the pivot to it center.

This is usually the case by default. If it does not work in your scene could you create a repro in the playground ?

1 Like

This is always a problem when moving from product A to product B and you find a method does not do as it did in product A. This is probably because the person who wrote the method for B was used to using product C and did it that way.

Best to say what it is you are trying to achieve and demonstrate what goes wrong in a playground.

1 Like

https://playground.babylonjs.com/#SKHBQT#9

Sorry to bother,I am newer of webgl 3d dev,I have copy your some code in playground, What I need is change local origin of a mesh for my transform work better, I use setPivotPoint and setPivotMatrix function but does’t work, do I have a mistake understanding?

https://playground.babylonjs.com/#SKHBQT#9

Thanks for you advice, I just need to set the local origin of a mesh. but I have not found a good way to do it.

I think it is the use of the parameter false you need, this resets the local origin

https://playground.babylonjs.com/#SKHBQT#10

2 Likes

Thanks a lot, I got it, Give false as second param of setPivotMatix function will not change the absolute position of the local origin in word coordinate but it will change mesh vertex position.
It sovles my problem!