Gizmo - DragBehavior - Resets on changing attached Mesh / Node

I noticed that when Gizmo dragBehavior is set as disabled before attaching a mesh/node to it, it’s not disabled.

Is it a requirement that Gizmo dragBehavior (enabled/disabled state) needs to be set only after a mesh is attached to it?

Gizmo - Disable before & after mesh attachment | Babylon.js Playground (babylonjs.com)

In this playground sample. In Line 19, X Gizmo is set as disabled before attaching a mesh to it. And in Line 21, Y Gizmo is set as disabled after attaching a mesh to the Gizmo.
But in the rendering, only Y Gizmo is disabled. X Gizmo is not disabled.

Later, when the attached mesh is changed (on key press), this disabled setting is lost and Gizmo becomes enabled.
(Uncommenting Line 33 & 34 would set it disabled after attaching mesh)

1 Like

Tagging @Cedric the gizmo master :slight_smile:

Yes, it’s by design. When a new node is attached, the pointerDragBehavior is enabled. It’s disabled when the attached node is null.
There is no behavior that fits everyone. For example, if pointerDragBehavior state was preserved when setting a new non-null node, then when a null node is attached, it stays disabled until you call setEnabled.
It this case or the current case, you have to re-set the enabled state.
At least, current ly, you only have to disabled axis you don’t need when setting a new attached node.

1 Like