Moving local origin of a mesh

I have a mesh which I’m modifying by editing its vertex data of position kind. The local origin was at the centre of the mesh before, but not anymore. How do I move it back? I tried mesh.setPivotPoint(), but it only moves the pivot point and not the local origin.

1 Like

What do you mean by local origin?
We have 3 concepts that could be candidates here:

  • vertex position
  • mesh.position
  • mesh.pivotPoint

I think it corresponds to absolutePosition property. If mesh.pivotPoint changes, mesh.position changes but absolutePosition does not. I want both of them to change to the “new centre” of the mesh.

Then you should use setPivotMatrix because you can set the second parameter to false to force it to change the absolutePosition
https://doc.babylonjs.com/how_to/pivots

2 Likes

Will look into that, thanks :slight_smile: