Set PivotPoint after rotating the mesh, the mesh will be displaced

Hello everyone, this is the first time I submit a bug on the forum, my English is not very good, please forgive me.

I encountered a problem, when I rotate the mesh, and then setPivotPoint to a world coordinate, the mesh will be displaced. You can reproduce the problem here:

By the way, there is also a small problem here, when I don’t call mesh.getAbsolutePosition(), I can’t get the world coordinates of pivotPoint through mesh.getAbsolutePivotPoint(). Is this intentional?

Really appreciate your help :slight_smile:


You should force matrix evaluation in cases like this


For your pivot issue, you can get more information in the docs here

Following the suggestion there you can correct the box position like in this playground.

1 Like

Thanks for your help!
It seems to have solved the problem now, but I still have some questions I want to ask for your help.

Do I need to call computeWorldMatrix after every move of the mesh, or once before setPivotPoint?
Also I don’t quite understand why this code box.position = box.position.add(box.position.subtract(box.getAbsolutePosition())); can’t be replaced with box.position = box.getAbsolutePosition().clone();?

Thanks again for your answer!:slight_smile:

You only need to call right after creation before setting it to be sure all the values are ready.

You can not replace the code cause it would not necessarily work if you had parent for instance

1 Like

Thank you very much, it seems that this is not a bug.
More questions I may be more appropriate to ask in Questions. Thank you again!