Breaking change in AxisScaleGizmo?

Hi,
Since Babylonjs 4.0, it appears to be a breaking change in AxisScaleGizmo.

The scaling is now determined by pixels moved by the mouse, opposed to distance moved in world coordinates as in v3.3. I found that behaviour more useful in most cases.

The scaleRatio can be changed, but it only set the size of the scale handle, which is normally just needed once, whereas the real scale factor can only be be set in the constructor, namely the dragAxis.

I found a workaround to modify the dragAxis by keeping the dragAxis vector given in the constructor, and then modify it later, but I guess that may stop working in the future if you decide to clone the vector instead of using the reference to the vector given in the constructor.

/EDIT: When setting the .uniformScaling flag, it no longer use the dragAxis to determine scaling (which I suppose is natural, since the components may differ), but it means I cannot use this flag, instead I set all components of dragAxis equal.

Ping @trevordev

Hey @tylo, can you share a playground so I can better understand like this one https://www.babylonjs-playground.com/index.html#31M2AP#10 ? I do remember a change was done as objects of different scales were having issues when dragging when it was using distance, is there a specific change you have in mind that could ensure your scenario still works?

Hi Team,
I am trying to use the AxisScaleGizmo for maintaining the aspect ratio. So, here I am using 1,1,1 for the dragAxis parameter. When I am trying to scale or move the gizmos pointer, it does not seems to be appropriate to the mouse movement. After a certain movement, there is a huge scaling done for the mesh. Here I have added the playground for your reference. Link - https://www.babylonjs-playground.com/index.html#31M2AP#285.

cc @Cedric

You can tweak sensitivity :

gizmo.sensitivity = 2;

I didn’t see the ‘huge scaling’, can you please do a video for the repro?

1 Like

Ho ! think I’ve found a repro. no need for a video. I’ll take a look beginning of next week.

1 Like

PR

2 Likes