Can non-uniform scaling be disabled on the bounding box gizmo

If I want to only be able to scale a plane mesh uniformly (keep aspect ratio), is there a way to disable the handles on the sides of the plane that let it be scaled in one axis only?

1 Like

cc @cedric

You can disable scaling axis with axisFactor

gizmo.axisFactor = new BABYLON.Vector3(1,0,0);

will disable axis that is not touched by X

Thanks. I wondered what axisFactor was but couldnā€™t find it documented anywhere.

Sorry, I realize my original question was misleading. If I disable x and y, then I canā€™t scale at all. But if I enable only x, then I can scale non-unifomrly in x which isnā€™t what I want. Iā€™d like to have corner affordances only, but still be able to scale uniformly in xy.

You can also tweak the scaling values with an observable like this:

gizmo.onScaleBoxDragObservable.add(() => {
  mesh.scaling.y = mesh.scaling.x;
  mesh.scaling.z = mesh.scaling.x;
});

That would just set the y scale and z scale to be the same as the x. I want the same aspect ratio, e.g. 8 x 6. I just want to hide or disable the scaling handles along the top and sides of the plane and only have scaling handles on the corner since those handles preserve aspect ratio.

We are feature locked until 5.0 release but Iā€™ve found a workaround by disable boxes you donā€™t need:

3 Likes

Hello @ericwood73 just checking in if your question has been answered

Yes. Sorry I forgot to mark the solution.

1 Like

Hey! Thanks for this suggestion, it really works. I was just wondering if it couldnā€™t be exposed through public BoundingBoxGizmo properties as I almost put the same question on the forum because I didnā€™t find the solution on the docs :blush:

Just a question. For the rest itā€™s amazing :slight_smile:

3 Likes