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 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
why not using a parent instead of a pivot here ? so you could rely on setParent which does the job for you ?
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…
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?
Hmm, if call setPivotPoint like below then is it rotating how you wanted?
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.
- 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.
- 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,
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.
Thanks, this is the best solution for me so far.