I noticed that if I modify the pivot point of a mesh with setPivotPoint the gizmos location does not update but their behavior does.
Example:Babylon.js Playground
In this playground I would expect that the rotation gizmo of the right sphere would be placed at the pivot point (red dot) instead of the center of the object. The current placement makes the rotation kinda inconvenient.
Of course I could create a parent node at the desired pivot location and use the gizmo of this node instead. However this might not always be feasible or desired.
Question:
I would like to know if this is intentionally or a bug.
If its a Bug I`ll happily try to look into the code and see if I could create a PR on that topic.
That’s expected. Gizmos are placed at local origin and rotation happens around pivot.
It can make sense to also have a different placement for gizmo (at origin or on pivot) but in order to keep back compatibility, it needs a new flag.
looking at this :
I think it ‘only’ needs to have this._rootMesh.position to be set when attaching node/mesh.
Special care needs to be taken when auto scaling is on or off as position is recomputed here:
EDIT: yes, a bug has been fixed in 2021 for that. check your PG with babylon 4.2.1 and you’ll see the pivot offset accumulate each frame with mouse input.
Thanks for the update. I understand that changing the behavior directly is not desired because of back compatibility.
If you like I would look into it and create a PR for adding an additional flag within the GizmoManager to define where the Gizmo should be placed [origin (default) or pivot]
@Cedric While testing the new feature I noticed that the BoundingBoxGizmo does not handle the pivot point as I would expect. As you can see in the video I can move the sphere around by rotating the object back and forth. Is this the expected behavior? I`m not sure if this only applies to a custom set pivot point or also to offcentered origin positions.