Why does resetting the pivot point change the position of the box?

:smiley:I think there should be a better way without resetting the rotation and scaling.

investigatingā€¦ (thanks for your patience)

Yes, but doesnā€™t this sound all a bit complicated to you Guys? May be should find a way to record and keep/freeze the mesh position while dragging the pivot to another position? Just a thought of mineā€¦ What are your thoughts?

Thatā€™s what I did by caching and maintaining the absolute position in the PG I postedā€¦ And I also tried my other idea of baking you quoted but it didnā€™t work and got edited out.

I know you did. Not what Iā€™m saying and (on behalf of the poster) thx for your efforts.
Itā€™s just that we have been struggling with this for a while (when I say ā€˜Weā€™, itā€™s actually mostly @JohnK and I believe he knows his business :smiley: so since this has been going on for a while, there might be something (just something) to be done/improved in the method of how we parent (and eventually delay) to a new pivot?

Edit: I hope I am not offending anyone with my broken english, am I? It just feels to me that some sort of improvement could may be be found for the method. Not speaking about the contribution of you Guys trying to find a solution. I hope this is clear for everyone. Meanwhile, have a great day :smiley:

1 Like

why not using a parent instead of a pivot here ? so you could rely on setParent which does the job for you ?

1 Like

Also hereā€™s a way to maintain the position and rotation when changing the pivot point. Although Iā€™m not for sure I think itā€™s what youā€™re afterā€¦ :slight_smile:

1 Like

Thank you for your answer,the result of setting the axis point should be wrong,by commenting on the 50th line of code, you can find that the axis point is not set correctly.

I tried commenting out line 50 like you said but it seems to be working as far as I can tell. Maybe you could explain more which parts arenā€™t working how you want and how you would want it to work?

123

Hmm, if call setPivotPoint like below then is it rotating how you wanted? :thinking:

Okay, my English is not good, I try to express it clearly.
There are 2 functions in my project that need to modify the pivot point.

  1. Objects in the scene may be bound with multiple animations. The pivot point needs to be switched between each animation. The position of the object cannot be changed when switching.
  2. Based on Babylonjs RotationGizmo, I developed a gizmo tool that rotates multiple objects together. When I select multiple objects, the gizmo position is in the center of the bounding box of multiple objects. When rotating, it rotates around this center. At the end, it is necessary to To restore the center of rotation, I modified the center of rotation by modifying the pivot point, but it doesnā€™t seem to work at the moment.Like this,
    123
1 Like

It doesnā€™t work when restoring the axis point, it should be something I wrote wrong

Actually it looks like when changing the pivot to the identity matrix then can just cache and set the absolute position like in the second time out below. :slight_smile:

2 Likes

Thanks, this is the best solution for me so far.
Best wishes

1 Like